dance2die
dance2die

Reputation: 36945

Why does WMI skip some services on ASP.NET page?

I am trying get all local machine services.

But why are some services missing from Win32_Service class?

WMI asp.net issue

Upvotes: 1

Views: 101

Answers (1)

Jack B Nimble
Jack B Nimble

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

Related Questions