Enumerate ManagementClass : ManagementClass « Windows « C# / C Sharp






Enumerate ManagementClass

  

using System;
using System.Management;
public class RemoteConnect 
{
    public static void Main() 
    {
        EnumerationOptions opt = new EnumerationOptions();
        opt.EnumerateDeep = true;
        ManagementClass c = new ManagementClass("CIM_Service");
        foreach (ManagementObject o in c.GetInstances(opt))
            Console.WriteLine(o["Name"]);
    }
}

   
    
  








Related examples in the same category

1.Initialize a ManagementClass and list its methods
2.Initialize a ManagementClass and Get the properties in the class
3.Initialize a ManagementClass and Get the Qualifiers in the class
4.Create ManagementObjectSearcher to query Win32_Service