|
-
Feb 4th, 2009, 12:11 PM
#1
Thread Starter
Addicted Member
[2005] Change Service Startup Type
I want to be able to get & change the startup type for a service through a Windows Application... (Automatic, Manual, Disabled)... Is there a simple way to do this? I didn't see anything using the ServiceController.... I found another thread to use a vbscript but rather do it directly through my application.
-
Feb 4th, 2009, 01:47 PM
#2
Re: [2005] Change Service Startup Type
You can use the ServiceController component, one second I will dig out the exact code
-
Feb 4th, 2009, 01:49 PM
#3
Re: [2005] Change Service Startup Type
Actually, my bad, you cant do it through the ServiceController. The way I have done it in the past is to use the built in program in windows named SC.EXE (ie just calling that from Process.Start with certain arguments)
However, if anyone has an all .NET way of doing it I would be interested to see it
-
Feb 5th, 2009, 12:22 AM
#4
Re: [2005] Change Service Startup Type
The startup type for a service is stored in the Registry, in the Start value under the "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\ServiceNameHere" key. You can use the My.Computer.Registry.GetValue and SetValue to manipulate it. The value is an integer:
2 = Automatic
3 = Manual
4 = Disabled
Last edited by jmcilhinney; Feb 5th, 2009 at 12:29 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|