I am currently starting a Service in my C# code using WMI, and I would like to set its startup parameters.
Is there a way to do this? I couldn't find anything relevant so far.
Thanks in advance.
Thomas.
I am currently starting a Service in my C# code using WMI, and I would like to set its startup parameters.
Is there a way to do this? I couldn't find anything relevant so far.
Thanks in advance.
Thomas.
These other posts helped me to solve my issue :
https://superuser.com/questions/809868/wmi-startservice-parameter
Check the open source project
Contains full usage of WMI with StartService
Example 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