By: Jugal Shah | Last Updated: 2010-05-17 | Comments (7) | Database Administration
When installing a SQL Server cluster, Services Packs, Hotfixes, etc.. there may be a need to reboot both the nodes for changes to take affect and to reboot the server we have to login to each node which is time consuming. Also, there may be a time when you are not able to login to the server after a reboot due to the server being hung. In this tip we will take a look at the SHUTDOWN command and how it could be used.
This article will guide you through how to use the DOS SHUTDOWN command in Windows to remotely shutdown, restart or log off the local or network computer..
Shutdown command is useful for these scenarios:
1. In case we have to restart multiple computers
2. Server is pingable, but not allowing user to login, in that case we can restart the server remotely
3. User is able to login, but can see only a blue screen, so at that time we can remotely restart the computer
You must have administrative access to the local or network computer to restart it remotely. For multiple computers in the domain it is recommended to use the Domain Administrator account.
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
Show the graphical user interface of shutdown window
To log off from the machine. Make sure that you are not using -l switch with -m switch
Shutdown the desired computer
Shutdown and restart the computer
Abort a system shutdown
-m\\machine name is used for to shutdown/restart/abort remote computer
Forces running application to close without warning
-t xx set timeout for shutdown command to xx seconds
-c"comment" to add shutdown comment, you can add up to max 127 characters
You can also see above output by executing shutdown \? command from DOS
SHUTDOWN command using GUI
Go to -> Run -- Cmd -- type the shutdown -I command
Here you can select the different options (Restart/Shutdown/Log Off) as per your need. Click on Add... button to add the remote server name.
Execute SHUTDOWN command using command prompt
Here I am restarting remote server (MSSSQLBOX) from the command prompt shutdown -m \\mssqlbox -r If you get an access denied/permission error, use the NET USE command net use \\machine /USER: shutdown -r -f -m \\machine name
- Take some time to lear about the different switches
- Create a batch file by adding a number of servers with the SHUTDOWN command
- Execute shutdown command by using the time (-s,-t) and immediately execute the abort (-a) command
Last Updated: 2010-05-17
About the author
View all my tips