How do I know the Description of the service that is running in remote machine in C#?

433 Views Asked by At

I know the service that is running using

ServiceController sc = new ServiceController();
ServiceController.GetServices(DropDownListMachineName.SelectedValue))

but ServiceController does not contain any method or property to get the Description of the service.

Any idea ?

2

There are 2 best solutions below

0
On

This MSDN page suggests:

ManagementObject wmiService;
wmiService = new ManagementObject("Win32_Service.Name='" + sc.ServiceName + "'");
wmiService.Get();
Console.WriteLine("    Description:     {0}", wmiService["Description"]);
0
On