The SHUTDOWN command

The SHUTDOWN command

The following example shows how to shut down a computer using the SHUTDOWN command. You can also shut down Windows NT based systems (NT, 2000, XP, 2003 Server) from a remote location.

I use it with my UPS. I have 2 machines connected to UPSs that do not have USB or Serial support. When the power goes out for more than 5 minutes, another machine connected to a USB UPS tells the other 2 machines to Shutdown.


Syntax for NT/2K (see below for XP)

     SHUTDOWN [\\Computer] [/L] [/A] [/R] [/T:xx] ["Msg"] [/Y] [/C]

key
      \\Computer : A remote computer to shutdown.
      /L : A local shutdown.(under XP this is a logoff only)
     "Msg" : An optional shutdown message
     /R : Shutdown and reboot
     /T:xx : Set the timer for system shutdown in seconds.[20 sec. default]
     /A : Abort a system shutdown during the timeout period.
     /Y : Answer all following questions with yes
     /C : Force running applications to close.
          ATTENTION: If you use the /C parameter shutdown will not prompt for File-Save in
          any open applications. This will result in a loss of all unsaved data!!!


Syntax for Windows XP and Windows 2003 Server:

     SHUTDOWN [options] [-m [\\ComputerName]]

options
     -M \\Computer : A remote computer to shutdown.
     -L : logoff current user
     -c "Msg" : An optional shutdown message
     -S : Shutdown
     -R : Shutdown and reboot
     -H : Hibernate (Hibernation must be enabled for this to work) Note: this does not work on all computers
     -A : Abort a system shutdown during the timeout period.
     -T:xx : Set the timer for system shutdown in seconds.[20 sec. default]
     -F : Force running applications to close.
          ATTENTION: If you use the -F parameter shutdown will not prompt for File-Save in
          any open applications. This will result in a loss of all unsaved data!!!
     -d u:xx:yy : List a USER reason code for the shutdown.
     -d P:xx:yy : List a PLANNED reason code for the shutdown.
          xx Specifies the major reason code (0-255)
          yy Specifies the minor reason code (0-65536)


e.g. To tell a remote machine to hibernate

     SHUTDOWN -h -m \\computer_name -t 003

When using this command to reboot a server - the shutdown can be made faster if the services
are halted using NET STOP - the NT shutdown process will normally allow about 30 seconds to
ensure each running service has time to stop.

e.g.
     net stop "Microsoft Exchange Internet Mail Service"
     net stop "Microsoft Exchange System Attendant" /y
     wait 20 seconds
     shutdown /Y /T:5 /C /R