开发者

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 ()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜