Windows 

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

Microsoft’s Remote Desktop service is a great way to manage remote Windows PCs, regardless of whether they’re in the next room or on the other side of the world. With a good network connection between systems, Remote Desktop gives a user virtually all of the power and capabilities in a remote session that they would enjoy if sitting in front of the remote computer directly, with one notable exception: shutdowns and reboots.

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.

disconnect-remote-desktop

Thankfully, you can still reboot or shut down a remote PC, but you’ll need to do it manually via the Command Prompt. While connected to a remote PC, save all open documents and then launch the Command Prompt from the Start Menu in Windows 7 and earlier (Start > Run > cmd) or search for Command Prompt or cmd from the Windows 8 Start Screen.

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:

Shutdown Command Parameters

Parameter Function
-s Shuts down the computer.
-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.

There are many more parameters and options for the shutdown command, most of which are only useful for those administering large networks. Small businesses and home users will primarily stick with the parameters above.

Shutdown Command Examples

To bring this all together, let’s go over a few examples. First, let’s say that you are connected to your office PC via Remote Desktop and you want to reboot it immediately. You know that no one else is using it and all of your documents and data are saved. While in the Remote Desktop session, launch Command Prompt on your office PC and type the following command:

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). In this case, we’re accessing the Command Prompt via Remote Desktop directly on the office PC, so we don’t need to specify the computer name with the -m parameter because we are, in effect, operating on the local machine, even though we’re not sitting in front of it.

command-prompt-shutdown

Here’s a second example: you work from home with your spouse, but have different offices in the house. In your office, you need to shut down your spouse’s computer (computer name “UPSTAIRS”) because a lightning storm is rolling in and you want to be on the safe side. You think your spouse isn’t currently using the computer, but you can’t be sure. Here’s a shutdown command that you could initiate on your own PC:

shutdown -s -f -m \\UPSTAIRS -t 60 -c “Shutting down for storm. Save work and close apps.”
This command shuts down the computer (-s), forces running applications to close (-f), designates the remote PC by name (-m \\UPSTAIRS) because you’re executing the command on your own PC, gives a time delay of 60 seconds (-t 60), and provides a descriptive message (-c) that will appear on your spouse’s computer to notify them of the impending shutdown.

Now, before you start worrying about pranksters and hackers remotely shutting down your PC without authorization, note that you’ll need to have admin access to the target PC you’re trying to shut down. That is, in our example, you’ll need to have an admin account on the “UPSTAIRS” PC with the same name and password as the account you’re using on your own PC. Alternatively, in business environments, your Active Directory account will need to be authorized on both PCs.

There are many more parameters and options, including some logging and reporting options that are useful to IT administrators. To view them all, bring up the shutdown command’s help document by typing:

shutdown /?

Related posts

Leave a Reply

%d bloggers like this: