Reputation: 36945
I am trying get all local machine services.
But why are some services missing from Win32_Service
class?
Upvotes: 1
Views: 101
Reputation: 5087
The services are not returned in alphabetical order. You need to sort your results otherwise you will have to hunt through the list to find them. They are all there in my tests.
My sample code:
ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_Service");
foreach (ManagementObject service in mos.Get())
{
listBox1.Items.Add(service["DisplayName"]);
}
listBox1.Sorted = true;
Upvotes: 1