Hugh,
Unfortunately (or is it fortunately) you cannot. As ServiceController is
really intended to manipulate the current instance of an *existing* service,
not the configuration of a service.
I know ServiceInstaller can, as it is intended to configure a service when
you install it. ServiceInstaller may be over kill in this case. My concern
with ServiceInstaller is changing more config then one should.
I'm not sure if WMI can change the configuration of a service.
I suspect you will need to call the Win32 API, unfortunately I don't have
examples of calling said Win32 API... If I find a sample or the API itself
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"Hugh Janus" <my*************@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
| Hi all.
|
| I am using the ServiceController class to interface with a service on a
| Windows 2003 Server. However, I cannot work out how to disable the
| service or set it to manual. Starting it and stopping it works fine
| but of course, after rebooting, the service restarts because it is set
| to Auto.
|
| Any ideas on how to do this? I would rather not use WMI unless there
| is not alternative simply because I can do everything else without it!
|
| Thanks.
|