我有我公司的这个 Windows 服务:
我想在后面的代码中从中获取服务描述!但由于某种原因,它不返回服务描述。
谁能帮我这个 。
这是我的代码,它返回什么:
Dim MyServices As ServiceController = New ServiceController("AccTech Exchange Rate Import")
Dim Status As String = MyServices.Status.ToString
Dim Name As String = MyServices.ServiceName
以及 MyService 变量返回的内容。
我如何从这里获得服务描述?
问候,
编辑:
这是 Miki Shah 为我指明正确方向后的代码!
Dim MyServices As ServiceController = New ServiceController("AccTech Exchange Rate Import")
Dim Status As String = MyServices.Status.ToString
Dim Name As String = MyServices.ServiceName
Dim Description As String
Dim objPath As String = String.Format("Win32_Service.Name='{0}'", Name)
Using service As New ManagementObject(New ManagementPath(objPath))
Description = service("Description")
End Using