Home / Software / Tips and Tricks / How to Shut Down and Reboot Remote PCs via the Command Prompt?

How to Shut Down and Reboot Remote PCs via the Command Prompt?

Updated:  04/04/2015 01:04 AM
Author:  Shiju Mathews

Status:    Resolved.


When we are working computers remotely, there is circumstances that we need to reboot the computer. If you open a Remote Desktop session to another Windows PC, even via an account with full admin privileges, you won’t be able to shut down or restart the PC via the traditional GUI methods. Heading to the Power Users Menu in Windows 8, for example, or the Start Menu in earlier versions of Windows, only reveals a “Disconnect” button where options like sleep, shutdown, and restart normally reside.
In the Command Prompt window, we’ll be using the command shutdown. But we can’t just use it by itself — doing so will simply log off the current user, but leave the PC powered on. Instead, like many command line operations, we’ll need to add specific parameters to tell the shutdown command exactly what we want to do. So, to get started, type “shutdown” into the Command Prompt window, followed by a single space. Next, we’ll add the necessary parameters, with the major ones listed below:

-s   Shuts down the comptuer.
-r   Reboots the computer.
-f   Force-close all running applications.
-m \\Computer   Specifies a specific computer on the network that you want to shut down or reboot. Absent this parameter, the command affects only the local PC on which it is run.
-t xx   Sets a delay (xx seconds) before the specified operation commences.
-c "message"    Add your own text inside the quotations to provide remote users with a message about why and when their PC will shut down or reboot. /a   Aborts a shutdown or restart if used during the (-t) delay period.
/h   Hibernates the computer.
/?   Displays the full help document with all commands.



Examples:
shutdown -r   [Reboots the computer]
shutdown -r -f -t 0   [That command will reboot the computer (-r), force all applications to close so that one doesn’t get stuck and prevent the reboot from happening (-f), and it will happen immediately with a zero second delay (-t 0).]