By: Jugal Shah | Updated: 2010-08-26 | Comments (3) | Related: More > Database Administration
Sometimes SQL Server services or any other Windows service does not start due to some issue after a server reboot. When you try to login to the server you find that you do not have remote login rights to that server or remote login is disabled for that server. Here is a solution to start the service remotely. This tip is also useful if you want to start a number of services in a particular order.
To control the services remotely, we can use either the services.msc GUI or the SC (Service Control) command to start, query, stop, create and delete any Windows service remotely. The SC command is very useful when remote login is disabled and we want to start the service.
Using the GUI - Services.msc
The first option is to use the Services application to control the services on a remote server. Type services.msc in the run window or go to Control Panel -> Administrative Tools -> Services. When this app opens, click on the Action menu and click on "Connect to another computer...".
Enter the remote computer name as shown below and it will load the services of the remote machine. Once you connect you can manage the services as your normally do.
Using Command Prompt
The other option is to use the command line tool SC.exe.
Basic Syntax for SC.exe
SC [\\server] [command] [service name] [Options]
To get a list of options you can run sc /? as shown below. The below image lists the commands you can use with SC.
Example 1 - Start the SQL Server Service
This command will start the SQL Server service on server "\\computer100".
sc \\computer100 START "mssqlserver"
Example 2 - Stop the SQL Server Service
This command will stop the SQL Server service on server "\\computer100".
sc \\computer100 STOP "mssqlserver"
- Use the other command options and check the output
- Create a batch file to start the different services using the SC command
- When running this make sure you have the correct permissions to start and stop the services otherwise you will get an "Access is denied" error message.
- When running the SC command on Vista, Windows 7, Windows 2008, etc... you may need to open the CMD prompt with the "Run as administrator" option.
- Read more about the SC command
Last Updated: 2010-08-26
About the author
View all my tips