How do I know the Description of the service that is running in remote machine in C#?
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 o开发者_开发技巧f the service.
Any idea ?
This MSDN page suggests:
ManagementObject wmiService;
wmiService = new ManagementObject("Win32_Service.Name='" + sc.ServiceName + "'");
wmiService.Get();
Console.WriteLine(" Description: {0}", wmiService["Description"]);
See this example:
ServiceController.GetServices Method ()
精彩评论