PsShutdown.exe / PsShutdown64.exe (SysInternals)

Initiate a shutdown/reboot of a local or remote computer, logoff a user, lock a system.

      PsShutdown [[\\computer[,computer[,..]]] | @file [-u user [-p passwd]]]
            [-f] [-c] [-t nn|h:m] [-n s] [-v nn]
               [-e [u|p]:xx:yy] [-m "message"]


   computer   The computer on which the user account resides. Default=local system 
              a wildcard (\\*), will affect all computers in the current domain.

   -p passwd  Specify a password for user (optional). Passed as clear text.
              If omitted, you will be prompted to enter a hidden password.

   -u user    Specify a user name for login to remote computer(optional).

   @file      Execute the command on each of the computers listed in the file.

   -a         Cancel a shutdown (only possible while a countdown is in progress).

   -c         Allow the shutdown to be cancelled by the interactive user.

   -d         Suspend the computer.

  -e [u|p]:xx:yy 
              Shutdown reason code, 'u' = user, 'p'= planned shutdown.
              xx is the major reason code (must be less than 256)
              yy is the minor reason code (must be less than 65536)

   -f         Force all running applications to exit during the shutdown
              instead of giving them a chance to gracefully save their data.

   -h         Hibernate the computer.

   -k         Poweroff the computer (reboot if poweroff is not supported).

   -l         Lock the computer
              On Vista and greater this requires the username and password of the account to lock
              Even with a password, the default permissions do not allow the screen to be locked.

  -m "message" Display a message to logged-on users when a shutdown countdown commences.

   -n         Timeout in seconds connecting to remote computers.

   -o         Logoff the console user.

   -r         Reboot after shutdown.

   -s         Shutdown without poweroff.

   -t         Countdown in seconds until the shutdown (default: 20 seconds)
              or the time of shutdown (in 24 hour notation).

   -v         Display message for the specified number of seconds before the shutdown. 
              default= display a shutdown notification dialog,
              specifying a value of 0 results in no dialog.

   -accepteula Suppress the display of the license dialog.

   -          Help, display the supported options.

This tool allows administrators to create a batch file that will run against multiple computers to perform a mass change of the administrator password.

PsShutdown has two features not found in the SHUTDOWN command:

When installing psShutdown.exe just ensure it is placed somewhere in either the system PATH or in the current directory.

When launched for the first time, PsShutdown will create the regkey


Reboot \\workstation64 as part of an OS upgrade:

C:\> psshutdown64.exe \\workstation64 -r -e p:2:3

Shutdown all the computers listed in a file (one per line):

C:\> psshutdown.exe @c:\scripts\computers.txt -s

“I shall go the way of the open sea, To the lands I knew before you came,
And the cool ocean breezes shall blow from me, The memory of your name” ~ Laurence Hope

Related commands

SHUTDOWN - With full list of reason codes.
PowerShell: Stop-Computer / Restart-Computer
Equivalent bash command (Linux): shutdown - Shutdown or restart Linux.

Copyright © 1999-2024
Some rights reserved