9

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

Posted by Jim Tanous on November 24, 2014
pc-power-button

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

[table id=13 /]
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 /?

While the intent of this article was to show you how to use the shutdown command to shut down or reboot remote PCs, you can always use any of the commands on your own local PC if you feel so inclined. So the next time you need to reboot, don’t head for the Start Menu or charms bar, get your geek on in the Command Prompt instead.

9 thoughts on “How to Shut Down and Reboot Remote PCs via the Command Prompt”

Pismo says:
This is a windows thing that requires usernames and passwords matching, admin accts, etc so it will never, never, never work..
Reply
Hem says:
how to block screenshot in windows
Reply
asdf says:
Actually the windows command prompt takes options like /r instead of -r. So in your example, the options passed are ignored and you’ve basically f’ed over anyone who is trying to reboot remotely. Good job!
Reply
TekRevue says:
Actually, while not every command accepts dash (-) switches, the shutdown command certainly does. It will work with both dash (-) and forward slash (/) switches. So, in our example, it works exactly as described.
But hey, thanks for the condescending, unhelpful, and objectively incorrect comment. Good job!
Reply
AB says:
Thank you. You just helped me reboot my machine remotely. Worked great!
MacrameTrumpToupee says:
Well, none of them work for me.
AB says:
You’re a moron! Delete your comment while you can.
Reply
youthsnews.com.au - ynn.io says:
thankyou
Reply
Jaymin Joshi says:
Even this tutorial is a very simple prank to http://www.searchithow.com/2015/02/how-to-remotely-shut-down-computer.html shut down computer remotely 😉
Reply
Dark Light says:
cool 🙂
Reply
김인섭 says:
씨발새꺄 95
Reply
John Mak says:
Hi Jim, that’s very helpful! I use a related software to connect to my desktop at home from my macbook and I didn’t know how to remotely reboot the PC cause sometimes the function of the app wasn’t working. Thanks for sharing!
Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.