|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How do I set Service Config?Is there a class or method that can be called to set the configuration
settings of an existing Windows Service? In particular I want to set the startup mode (i.e, Manual, AutoStart, etc..). I can do it with a pinvoke, but I wanted to check first to see if there was a way to do it natively. I noticed there is a ServiceController class, but in only allows checking of the status, and not setting it. -- ----------------------------------- Ken Varn Senior Software Engineer Diebold Inc. EmailID = varnk Domain = Diebold.com ----------------------------------- Ken Varn wrote:
> Is there a class or method that can be called to set the configuration No, I don't believe there's any way to do this. You can alter some settings > settings of an existing Windows Service? In particular I want to set > the startup mode (i.e, Manual, AutoStart, etc..). I can do it with a > pinvoke, but I wanted to check first to see if there was a way to do > it natively. I noticed there is a ServiceController class, but in > only allows checking of the status, and not setting it. using ServiceInstaller by uninstalling and reinstalling the service, but to do this the service has to be stopped and you need sufficient rights to install services (plus ServiceInstaller isn't intended to be invoked directly). From within the service you can alter some things through protected members of the ServiceBase class, but not any of the configuration properties. I hope you'll consider wrapping your P/Invoke calls in a little class library for reuse by others. -- Derrick Coetzee, MCAD, MSFT (Speech Server) This posting is provided "AS IS" with no warranties, and confers no rights. |
|||||||||||||||||||||||