DEV Community

Victor James
Victor James

Posted on • Originally published at windowscmd.com on

PsShutdown Command: Shutdown/Reboots the computer

PsShutdown

PsShutdown

The PsShutdown windows command-line tool is to shut down or else reboot the computer. This PsShutdown windows command-line utility is to shut down the computer from the command line.

CMD Line

CMD Line is a text-based interface that transfers the command from the user to the OS.

CLI-Command Line Interpreter

The command-line interpreter (CLI) for windows is CMD.EXE. Also, you can use PowerShell, which can automate many system administration tasks and these tasks are not approachable in command prompt. With the help of the CLI, you can communicate with your system by typing the text in commands. As a result, your system answers to the reader that you have typed previously, and then the user can proceed with the next command line that shows up.

To open the Run command Window

Run command window helps you to run programs, open the files and folders. And there are several ways to open up the run command dialogue box. This run command box is useful for you to head straight to the destined program easily.

By using the Keyboard shortcut Key:

WINDOWS+R

The shortcut key method to the run command box is the most commonly used one. Also, this method is in all versions of Windows. You need to press the Windows+ R ** ** key concurrently to open the Run command dialogue box.

Run command box
Run command box

What does the PsShutdown Command do?

As we mentioned earlier in this article, the PsShutdown command line shutdowns or else reboots a local or remote computer from the command line. By using this command-line utility, you can log off a user and can also lock the system.

PsShutdown will form a reg key when started for the first time, HKCU\Software\Sysinternals\PsFile\EulaAccepted=0x01.

Syntax


psshutdown [[\\computer[,computer[,..]]] | @file [-u user [-p passwd]]]
         -s|-r|-h|-d|-k|-a|-l|-o 
            [-f] [-c] [-t nn|h:m] [-n s] [-v nn]
               [-e [u|p]:xx:yy] [-m "message"]

Enter fullscreen mode Exit fullscreen mode

Available Options

Computer – Indicates the *computer * on which the user account resides, default=local system. A wildcard (*) will influence all computers in the current domain.

-p passwd – Specifies a *password * for the user, optional one. Passed as clear text. In case if it is excluded, it will propel you to enter a secret password.

-u user – Indicates the *username * for login to the remote computer, optional one.

@file – Executes the command on each of the computers listed in the file.

-a – This option *cancels * a shutdown that it can do while a countdown is in process.

-c – Permits the shutdown to be canceled by the interactive user

-d – Suspends 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. It must be less than 65536

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

-h – *Hibernates * the computer.

-kPower off the computer or it will reboot if power off is not supported.

-l – *Locks * the computer.

-m “message” – This option shows a ** message to logged-on users** when a shutdown countdown commences.

-n – Indicates ** timeout in seconds** , connecting to remote computers.

-o – Logoffs the console user.

-r – Reboots after ** shutdown**.

-s – Shutdowns without power off.

-t – Indicates the countdown in seconds until the shutdown, default= 20 seconds , or the time of shutdown is in 24-hour notation.

-v – Displays message for the specified number of seconds before the shutdown.

-accepteula – Suppresses the display of the licensing dialogue.

Help – Displays the supported options.

How does PsShutdown differ from the SHUTDOWN command?

  • Two features that cannot be done by the command SHUTDOWN but by the command PsSHUTDOWN command are
    • In PsShutdown an interactive user cannot halt the shutdown ** as, by default, this command **forces the shutdown and reboot process.
    • And the second one is we can target several other Computers at once.

Examples

  • In order to reboot a system counted as an OS upgrade, you can use

psshutdown \\admin -r -e p:2:3

Enter fullscreen mode Exit fullscreen mode
  • For to shut down all the computers listed in a file, you can use

psshutdown @c:\scripts\computers.txt -s

Enter fullscreen mode Exit fullscreen mode

Verdict

In this guide, we have stated the PsShutdown windows command-line tool with its syntax and examples. Hope you find this article a useful one. Leave your valuable comments in the comment box regarding this article.

Reference Articles

The post PsShutdown Command: Shutdown/Reboots the computer appeared first on Windows Commands- SS64 Commands.

Discussion (0)