Retrieve the DeskTop Details using WMI

Using this Function we can Retrieve the DeskTop details.



private void getDesktopDetails()
{

ManagementObjectSearcher objMOS = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Desktop ");

foreach (ManagementObject objManagemnet in objMOS.Get())
{
try
{
using(StreamWriter objStreamWriter = new StreamWriter(@"D:\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());
}
}


}



Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: