我目前正在使用WMI在我的C#代码中启动一个服务,我想设置它的启动参数。
有办法做到这一点吗?到目前为止,我找不到任何相关内容。
提前致谢。
托马斯。
答案 0 :(得分:0)
这些其他帖子帮助我解决了我的问题:
https://superuser.com/questions/809868/wmi-startservice-parameter
答案 1 :(得分:0)
检查开源项目
包含使用StartService
的WMI的完整用法示例VB.Net:
Dim objPath = "\\ComputerName\root\cimv2:Win32_Service.Name='ServiceName'"
Using objService As New ManagementObject(objPath)
Dim outParams = objService.InvokeMethod("StartService", Nothing)
rtnVal.WmiValue = CInt(outParams)
End Using