Restart Windows Server 2003 from the command line

When the Windows Server 2003 computer you are working on will not shut down and you don’t have any luck using the Start menu or the [Ctrl][Alt][Delete] methods — and you need to restart the server as quickly as possible — Derek Schauland can help you. Here is a quick workaround that gets the job done — and you don’t even have to handle power cords or the power switch.

Jan 14, 2008
3 minute read
We may earn from vendors via affiliate links or sponsorships. This might affect product placement on our site, but not the content of our reviews. See our Terms of Use for details.

The Windows Server 2003 computer you are working on will not shut down. You don’t have any luck using the Start menu or the [Ctrl][Alt][Delete] methods, and you need to restart the server as quickly as possible. There is a quick workaround that gets the job done — and you don’t even have to handle power cords or the power switch.

From the command line, you can shut down or reboot any Windows Server 2003 computer (or even Windows XP or Vista machines) with the Shutdown.exe command. (Note: The exe file extension is optional for the Shutdown command.) Shutdown.exe contains a number of switches that allow you to specify different actions for the server when the Shutdown command executes. The Shutdown.exe switches are as follows:

/?Displays the Help listing
/iDisplays the graphical user interface (GUI); it must be the first option
/lLogs off the current user; it cannot be used with the /d or /m options
/sShuts down the computer
/rShuts down and restarts the computer
/gShuts down and restarts the computer and then restarts any registered applications
/aAborts system Shutdown
/pTurns off the local computer with no timeout or warning
/hHibernates the local machine
/eDocuments the reason for shutting down the computer
/mSpecifies the target computer; it is used with \\computername
/t xxxWhere xxx is the number of seconds before Shutdown
/c “comment”Where “comment” is the reason for the Shutdown or restart
/fForces running applications to close without warning users
/d [p|u:]xx:yyProvides the reason for the Shutdown action: p = planned; u= unplanned; xx supplies the major reason code; yy = supplies the minor reason code

When you enter a Shutdown with no arguments, the Help listing will display. The Help listing also includes the reason codes available for use with the /d switch. The reason codes are shown below:

Reasons on this computer:

E=ExpectedU=UnexpectedP=Plannedc=Customer Defined
TypeMajorMinorTitle
    
U00Other(Unplanned)
E00Other(Unplanned)
EP00Other(Planned)
U05Other Failure: System Unresponsive
E11Hardware: Maintenance(Unplanned)
EP11Hardware: Maintenance(Planned)
E12Hardware: Installation(Unplanned)
EP12Hardware: Installation(Planned)
P23Operating System: Upgrade (Planned)
E24Operating System:

Reconfiguration (Unplanned)

EP24Operating System:

Reconfiguration(Planned)

P216Operating System:

Service Pack (Planned)

U217Operating System:

Hotfix (Unplanned)

P217Operating System:

Hotfix(Planned)

U218Operating System:

Security Fix(Unplanned)

P218Operating System:

Security Fix(Planned)

E41Application: Maintenance(Unplanned)
EP41Application: Maintenance(Planned)
EP42Application: Installation(Planned)
E45Application: Unresponsive
E46Application: Unstable
U515System Failure: Stop Error
E519Security Issue
U519Security Issue
EP519Security Issue
E520Loss of Network Connectivity

(Unplanned)

U611Power Failure: Cord Unplugged
U612Power Failure: Environment
P70Legacy API Shutdown
Advertisement

You can use many of these switches in conjunction with one another when issuing the Shutdown command. A usage example for the Shutdown command follows:

Shutdown /r /c “Hanging Application or service” /t 30

This example would restart the local machine storing the comment provided with the /c switch. Windows would wait 30 seconds before initiating the restart. You might also create a batch file to use when it is necessary to restart a server in a remote location. The batch file might look like this:

Shutdown /m \\computername /r /c “Remote Restart” /t 45

By saving this command in a batch file, it can save you time if you routinely restart the same remote server.

Miss a Windows Server 2003 tip?

Check out the Windows Server 2003 archive to get even more Windows Server 2003 tips.

Stay on top of the latest Windows Server 2003 tips and tricks with our free Windows Server newsletter, delivered each Wednesday. Automatically sign up today!

derek schauland

Derek is a seasoned cloud engineer with expertise in Azure and Google Cloud. He has held roles ranging from IT manager in manufacturing to consultant, bringing a broad perspective to his work. Derek is the author of three books on Windows, PowerShell, and Azure certification and has contributed to publications like TechRepublic. A former Microsoft MVP (2008–2018) in File System Storage and Cloud and Datacenter Management, he is passionate about sharing knowledge and advancing technology expertise.