Windows Service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I pass parameters to a service using WMI when starting?

----------------------------------------------

string ServiceAction = "StartService";

ManagementOperationObserver observer = new ManagementOperationObserver();

BlackBoxManager.ServiceHandler oServiceHandler = new ServiceHandler();

observer.ObjectReady += new ObjectReadyEventHandler(oServiceHandler.Done);


ManagementObjectCollection queryCollection;

queryCollection = getServiceCollection("Select * from Win32_Service Where
Name = '" + ServiceName + "'");

foreach (ManagementObject mo in queryCollection)

{

mo.InvokeMethod(observer, ServiceAction, inParams,null);

}

----------------------------------------------
 
See there
http://msdn.microsoft.com/library/d...mmanagementmanagementclassclassctortopic6.asp

Rui said:
How do I pass parameters to a service using WMI when starting?

----------------------------------------------

string ServiceAction = "StartService";

ManagementOperationObserver observer = new ManagementOperationObserver();

BlackBoxManager.ServiceHandler oServiceHandler = new ServiceHandler();

observer.ObjectReady += new ObjectReadyEventHandler(oServiceHandler.Done);


ManagementObjectCollection queryCollection;

queryCollection = getServiceCollection("Select * from Win32_Service Where
Name = '" + ServiceName + "'");

foreach (ManagementObject mo in queryCollection)

{

mo.InvokeMethod(observer, ServiceAction, inParams,null);

}

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top