开发者

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

开发者 https://www.devze.com 2023-02-09 09:09 出处:网络
I know the service that is running using ServiceController sc = new ServiceController(); ServiceController.GetServices(DropDownListMachineName.SelectedValue))

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

精彩评论

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