Remotely Shutdown, Restart or Log Off the local or network computers

By:   |   Updated: 2010-05-17   |   Comments (7)   |   Related: More > Database Administration


Problem

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.

Solution

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

Permission

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.

Command Syntax

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

-i Show the graphical user interface of shutdown window
-l To log off from the machine. Make sure that you are not using -l switch with -m switch
-s Shutdown the desired computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m -m\\machine name is used for to shutdown/restart/abort remote computer
-f Forces running application to close without warning
-t -t xx set timeout for shutdown command to xx seconds
-c -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 and type Cmd to open a command window

Go to - Run -- Cmd -- type the shutdown -I command

In the command window type

shutdown -I

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.

you can select the different options (Restart/Shutdown/Log Off) as per your need

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
Next Steps
  • 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


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Jugal Shah Jugal Shah has 8+ years of extensive SQL Server experience and has worked on SQL Server 2000, 2005, 2008 and 2008 R2.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2010-05-17

Comments For This Article




Wednesday, November 2, 2016 - 6:57:05 AM - Makarov Back To Top (43679)

 

 awesome

Thanks for sharing

this command helped a lot

i didnt know it existed

 


Wednesday, July 10, 2013 - 1:56:32 AM - manjunath Back To Top (25770)

 

 

 

when we give the restart or shutdown  the windows server 2008r2 it's go to log off

so please give me to solutions of this problem

manjunath@venturessolutions


Wednesday, June 12, 2013 - 8:22:10 AM - David Back To Top (25404)

My office have over 100 computers and it was controlled by a network server. I would like to create a bat file on VBS to restart all computers everyday at 6PM. How can I do that? Please help!


Thursday, February 14, 2013 - 10:16:02 AM - Heavenly Back To Top (22121)

if someone can tell me how to shutdown a computer on the network without the administrator account, just anonymously, this is not for hacking but a project, I am a student and my project is Web Based PC Remote Management System and Desktop Sharing. If anyone can tell me please I am badly in need of help right now T_T :'(

 

by the way my subject is Advance Web so I have to use

HTML, XML, HTTPRequest, PHP, Ajax, Jquery, Java Script and ASP if possible

 

the main feature of this project is

1. Control a computer on a LAN remotely with my mouse and keyboard

2. Shutoff/ Restart/Send Message/Standby/Wakeup a computer on LAN

3. File Transfer

 

please please please send help if any at my e-mail: [email protected]


Monday, November 26, 2012 - 10:32:20 AM - Jugal Back To Top (20538)

You must need the shutdown permission from GPO if you don't have admin right.


Monday, November 26, 2012 - 4:23:39 AM - J Ohn Revert Welt Gonsalvous Back To Top (20530)

How can i shutdown a remote computer without administrator privillages. please give me a replay.


Friday, August 31, 2012 - 11:26:54 AM - Ben Back To Top (19347)

 

I have been having a problem for a long time now where only one computer on the network just logs off randomly.  It goes for weeks with no issue and then this week it has happened more than half a dozen times.  No events in the event logs so I imagine the computer is just responding to a command to log off.  I can't figure out how it happens and cannot recreate it on the computer itself with like a hot key or something of the like.  Since this article makes it clear that it can be done remotely, is there a log somewhere that will show when this is innitiated so I might be able to determine what is doing it?















get free sql tips
agree to terms