1

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.

Thomas KiTe Trentin
  • 600
  • 1
  • 5
  • 19

2 Answers2

0

These other posts helped me to solve my issue :

https://superuser.com/questions/809868/wmi-startservice-parameter

Dynamics AX 2012 RegConfig does not work

Community
  • 1
  • 1
Thomas KiTe Trentin
  • 600
  • 1
  • 5
  • 19
0

Check the open source project

Services+

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
Sameh
  • 934
  • 1
  • 14
  • 40
  • Yes, and after a lot of investigation it appeared that it is not possible to send parameters at start of a service using WMI. Look my answer to see (second link) to see the solution I adopted. – Thomas KiTe Trentin Oct 24 '14 at 13:25