Cancel Windows Shutdown

Abort the Shutdown Command in Windows ServerWindows Server 2008 Shutdown Tip

The situation: you have just used the Windows Shutdown command, but now you want to abort.

Topics For Cancel Windows Shutdown


Shutdown.exe Command – Preamble

This shutdown utility is built-in to Windows operating systems, thus is available at the command line.

To see the Shutdown utility, Click on the Start Orb, type cmd; remember to right-click and ‘Run as administrator’. 

As its name suggests this program downs a server, or if you prefer, use the -r switch to reboot. 

Mission To Cancel Windows Shutdown

It’s often the -m switch that causes the trouble.  You want to reboot a remote machine, but accidentally omit the -machine switch and thus set in motion the shutdown sequence for the wrong computer.

If you make this mistake you have 30 seconds to abort the mission.  You can cancel the Windows shutdown with the -a switch.

If you have any experience of the command line then keystrokes are simple enough:

-a  Is for abort.  Naturally it only works during the time-out period.  The syntax is deceptively simple:Windows Server 2008 Shutdown Tip

Shutdown -a

Avoid overthink, you don’t need the -m switch or the machine’s name.  If the cancel command worked, then Windows Server 2008 will display the message shown in the screen shot to the right.

shutdown /a 
(This also works because the command is not case sensitve and you can use the modern -dash or the old-fashioned /hypen

Note 1:  Shutdown’s default is the local machine!  Thus introduce the -m switch if your intention is to restart a remote computer.

Note 2: While your ‘victim’ is probably a Windows Server, you can launch the command from Windows 7 or earlier Microsoft clients.

Courage and Confidence for Newbies

The first time want to practice cancelling a shutdown with -a you are bound to be a little nervous that it won’t work.  For this reason I suggest that those with a cautionary disposition try this on a laptop rather than a server.  Yes shutdown is available on all Windows operating sytems.

Another aid is Shudown’s GUI, I recommend that you try Shutdown -i and issue the commands from the Windows interface.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v12 v12

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

Perhaps the NPM’s best feature is the way it suggests solutions to network problems.  Its second best feature is the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you give this Network Performance Monitor a try.

Download your free trial of SolarWinds Network Performance Monitor.

Problems With Cancel Windows Shutdown

The most frustrating feature of the abort switch is that you have to execute the command not the machine which issued the command, but on the machine that is about to stop.  Let me explain:

You are logged on at BigServer, you type: shutdown -r -m \\MailServer
But you meant to type: shutdown -r -m SqlServer

You type shutdown -a

This is no good, your own machine has no shutdown command in its pipeline so ignores the command.  The only way would be to rush over to MailServer and issue the cancel shutdown command on that machine.

You have one faint chance, you could use remote desktop connection but you will have to be quick, normally you only have 30 seconds before the command starts taking effect.  Conclusion if you are unsure have a Remote Desktop connection setup before you down experiment with shutdown’s -m switch.

Windows Shutdown – Check the Additional Commands

Here is addition information about the optional commands to remotely restart your Windows Server.

-t is for time.  Is 30 seconds too long or too short a time?   You can adjust with -t: 60 to display the dialog box for one minute.  The maximum time is 600 seconds!

-f is for force.  ‘Mr Nasty’, is coming – ready or not!  Shutdown -r -f as you may have guessed, restarts the machine, and closes any programs without warning.Windows Server 2008 Shutdown Tip

-c is for a comment.  Would you like to put your stamp on the shutdown?  Let people know who is in charge, who is restarting their server?  -c "Guy is shutting you down"

-d p:4:1 reason.  Personally, I would avoid this switch, the syntax is tricky the numbers obscure, and it does nothing exciting.  That said the idea is sound, it enters a reason for the shutdown in the event log.  If you activate shutdown’s help, then you will get a whole list of major and minor reasons that you could employ with this switch.  For me, this switch is an option, an option that I do not take.

Note 1: The shutdown command line switches work equally well with a forward slash, for example, /d, /r or /a  
(instead of -d, -r or -a)

Note 2: Here is another example of Shutdown in action

Launch The GUI With Shutdown -i

You could just click on the Start orb and type: ‘Shutdown -i’.

Consider making a shortcut to shutdown.  The advantage is that you can include the -i  (/i) for interactive switch.  The benefit is that you have a GUI to control your remote server restarts. 

Just right-click the desktop,  New, Shortcut, type
Shutdown -i

A shortcut is born.  (See screenshot above right).

Guy Recommends: SolarWinds Free Wake-On-LAN UtilitySolarwinds Wake-On-LAN

Encouraging computers to sleep when they’re not in use is a great idea – until you are away from your desk and need a file on that remote sleeping machine!

WOL also has business uses for example, rousing machines so that they can have update patches applied.  My real reason for recommending you download this free tool is because it’s so much fun sending those ‘Magic Packets’. Give WOL a try – it’s free.

Download your free copy of SolarWinds Wake-On-LAN

Full List of Windows Server Shutdown Commands

Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

/i Display the graphical user interface (GUI). This must be the first option.
/l Log off. This cannot be used with /m or /d options.
/s Shutdown the computer.
/r Shutdown and restart the computer.
/g Shutdown and restart the computer. After the system is rebooted, restart any registered applications.
/a Abort a system shutdown. This can only be used during the time-out period.
/p Turn off the local computer with no time-out or warning. Can be used with /d and /f options.
/h Hibernate the local computer. Can be used with the /f option.
/e Document the reason for an unexpected shutdown of a computer.
/m \\computer Specify the target computer.
/t xxx Set the time-out period before shutdown to xxx seconds.
The valid range is 0-315360000 (10 years), with a default of 30. If the timeout period is greater than 0, the /f parameter is implied.
/c "comment" Comment on the reason for the restart or shutdown. Maximum of 512 characters allowed.
/f Force running applications to close without forewarning users. The /f parameter is implied when a value greater than 0 is specified for the /t parameter.
/d [p|u:]xx:yy Provide the reason for the restart or shutdown.
p indicates that the restart or shutdown is planned.
u indicates that the reason is user defined. If neither p nor u is specified the restart or shutdown is unplanned.
xx is the major reason number (positive integer less than 256).
yy is the minor reason number (positive integer less than 65536).

Restart-Computer PowerShell Cmdlet

As an alternative to the built-in Windows Server shutdown command try PowerShell.  It has a family of cmdlets such as Stop-Computer and Restart-Computer.  A likely scenario is that you wish to automate the reboot of a remote server.  With a tiny substitution to the cmdlet’s verb you could change the command so that it simply shuts down the computer.  See more about using PowerShell’s restart-Computer cmdlet.

Separate Problem Event Tracker Turn off Shutdown Event Tracker in Windows Server 2003

How to disable the annoying shutdown tracker.

Here are instructions to modify group policy to disable shutdown tracker.

Summary of Cancel Windows Shutdown

Despite what anyone tells you, nobody gets to be an expert with Shutdown without accidentally downing the local machine instead of the target computer.  To recover from this mistake pay close attention to the syntax of Shutdown’s abort switch -a.

It’s fun to use the Windows shutdown utility, and one day they will save you a long walk when you want reboot a remote computer.  My advice is to perfect the -a (abort) switch, that way you won’t panic if you issue a command to shutdown the local computer instead of the network machine. 

If you like this page then please share it with your friends


Microsoft Windows Server 2008 Topics:

Server 2008 Home   • Overview   • What’s New?   • Server Manager   • Install

Hyper-V   • Windows LDP.exe download   • Group Policy   • Remote restart Windows server

Network Performance Monitor   • Windows Server 2012   • SP1 Review   • IPAM 3 Review