using System.Management;
ManagementObjectSearcher objMOS = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Desktop ");
foreach (ManagementObject objManagemnet in objMOS.Get())
{
try
{
using(StreamWriter objStreamWriter = new StreamWriter(@"C:\DesktopDetails.txt"))
{
objStreamWriter.WriteLine("======================================================================");
objStreamWriter.WriteLine(" DeskTop Details "); objStreamWriter.WriteLine("======================================================================"); objStreamWriter.WriteLine("BorderWidth :" + Convert.ToString(objManagemnet.GetPropertyValue("BorderWidth")));
objStreamWriter.WriteLine("Caption :" + Convert.ToString(objManagemnet.GetPropertyValue("Caption")));
objStreamWriter.WriteLine("Description :" + Convert.ToString(objManagemnet.GetPropertyValue("Description")));
objStreamWriter.WriteLine("IconSpacing :" + Convert.ToString(objManagemnet.GetPropertyValue("IconSpacing")));
objStreamWriter.WriteLine("IconTitleFaceName :" + Convert.ToString(objManagemnet.GetPropertyValue("IconTitleFaceName"))); objStreamWriter.WriteLine("Name :" + Convert.ToString(objManagemnet.GetPropertyValue("Name")));
objStreamWriter.WriteLine("ScreenSaverActive :" + Convert.ToString(objManagemnet.GetPropertyValue("ScreenSaverActive"))); objStreamWriter.WriteLine("ScreenSaverExecutable :" + Convert.ToString(objManagemnet.GetPropertyValue("ScreenSaverExecutable"))); objStreamWriter.WriteLine("ScreenSaverSecure :" + Convert.ToString(objManagemnet.GetPropertyValue("ScreenSaverSecure"))); objStreamWriter.WriteLine("ScreenSaverTimeout :" + Convert.ToString(objManagemnet.GetPropertyValue("ScreenSaverTimeout"))); objStreamWriter.WriteLine("SettingID :" + Convert.ToString(objManagemnet.GetPropertyValue("SettingID")));
objStreamWriter.WriteLine("Wallpaper :" + Convert.ToString(objManagemnet.GetPropertyValue("Wallpaper")));
objStreamWriter.WriteLine("WallpaperStretched :" + Convert.ToString(objManagemnet.GetPropertyValue("WallpaperStretched"))); objStreamWriter.WriteLine("WallpaperTiled :" + Convert.ToString(objManagemnet.GetPropertyValue("WallpaperTiled")));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
No comments:
Post a Comment