How to change the startup type of a service using a command line

How to change the startup type of a service using a command lineMost of you who work in IT Support or system administration, know the importance of scripting and command line. It can save you hours of work if you are able to attain what you want to using the command line and use it in a script. In this article we will show you how you can change the startup type of a Windows Service using command line. Many of you might have used the "net start" and "net stop" commands in  a batch file to start or stop a Windows service. How do you change the startup type of a service, to automatic, manual or disabled though ? There are several ways of doing it, you can use VBScript or WMI (Windows Media Instrumentation) but in our example here, we will use our good old friend, the batch file. You can run the batch script on the current machine or even a remote machine to manipulate the service properties.

1. In our example we will be manipulating a Windows Seven service called "Multimedia Class Scheduler" , this service is usually set to automatic but by default is not started. We will use our commands to show its current state and then change its service startup to manual. It is important to point out that the "Display Name" of a Windows Service as it appears in Windows Service Manager, is actually different from the "Service Name". In the example here for Multimedia Class Scheduler the actual service name is MMCSS

DIsplay name of a Windows Service is different than its service name

2. SC is a command-line program used for communicating with the Service Control Manager and Services. To change service startup state of the MMCSS service to auto, give the following command on a command prompt that you open with administrative privileges:
sc config mmcss start=  auto

Use SC command to set the Windows Service to start automatically

3. To change the startup type to delayed-auto using a command line, simply open up a Command Prompt as an administrator or with administrative privileges and give the following command
sc config mmcss start=  delayed-auto

Use the SC command to set the windows service for a delayed auto start

The SC command can be used in a variety of ways to a lot of other things than just configure services. Complete help can be obtained by giving the command sc /?

For a complete list as well as examples, you can check Microsoft's website for details at http://technet.microsoft.com/en-us/library/cc739213(WS.10).aspx