Creating a service that takes parameters with WMI
Posted
by Johan_B
on Stack Overflow
See other posts from Stack Overflow
or by Johan_B
Published on 2010-04-28T13:30:49Z
Indexed on
2010/04/28
13:33 UTC
Read the original article
Hit count: 370
wmi-service
I want to create a service that takes some parameters. How do I do this with WMI?
In the commandline, it was
sc create ServiceName binPath= ""C:\Path\Service.exe\" /Service somefile1.xml somefile2.xml" start=auto DisplayName="DisplayName"
I have tried to use
ManagementBaseObject inParams = managementClass.GetMethodParameters("create");
inParams["CommandLine"] = ""C:\Path\Service.exe\" somefile1.xml somefile2.xml"
inParams["StartMode"] = StartMode.Auto;
inParasm["DisplayName"] = "displayName";
but I do not know how to pass the two xml files?
Any help will be greatly appreciated.
Thanks! JB
© Stack Overflow or respective owner