StartupMode for Services
-
Hi All, How can i change the startup mode for services that are already installed in machine using C# code. i tried using ServiceController class in C# but i was not able to find any method to change the start up method for services that are already installed. Thanks in advance
-
Hi All, How can i change the startup mode for services that are already installed in machine using C# code. i tried using ServiceController class in C# but i was not able to find any method to change the start up method for services that are already installed. Thanks in advance
Vijjuuuuuuuuu........... wrote:
How can i change the startup mode for services that are already installed in machine using C# code.
If this is already running, you can change the startup mode from Service Windows [ Run > Services.msc ]. If you want to change it in you code, You have to change the StartUp Type of of your Service Installer.
serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Vijjuuuuuuuuu........... wrote:
How can i change the startup mode for services that are already installed in machine using C# code.
If this is already running, you can change the startup mode from Service Windows [ Run > Services.msc ]. If you want to change it in you code, You have to change the StartUp Type of of your Service Installer.
serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
Thanks for reply but the code that you provided is when we are installing the own service . My need is i want to change the already installed services , for example windows services are installed with default value . i want to change them .. hope you got my question
-
Thanks for reply but the code that you provided is when we are installing the own service . My need is i want to change the already installed services , for example windows services are installed with default value . i want to change them .. hope you got my question
That I have already mentioned to you. Start > Run > Services.msc> Right Click on The Services > Change the Startup Mode. If you have to code, then you need to change and reinstall the service again !
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Hi All, How can i change the startup mode for services that are already installed in machine using C# code. i tried using ServiceController class in C# but i was not able to find any method to change the start up method for services that are already installed. Thanks in advance
You could try by changing the
Start
value in the registry for your service (though I haven't tried this myself, but I figure it would work).HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName\
Start REG_DWORD (2)
<- Change this value to either: 2 = Automatic 3 = Manual 4 = Disabled -
You could try by changing the
Start
value in the registry for your service (though I haven't tried this myself, but I figure it would work).HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName\
Start REG_DWORD (2)
<- Change this value to either: 2 = Automatic 3 = Manual 4 = DisabledWould it be any problem if we change it from
Service Console
?Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Would it be any problem if we change it from
Service Console
?Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.