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

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 shutdowncommand 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 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.

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

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 shutdowncommand 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.

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.

How to schedule reboot of windows server 2012?

Steps:

  1. Open Run prompt, type taskschd.msc and click ok.

Image result for task scheduler reboot

  1. Now Go to Action >> Create task.

    Create Task

  2. set the name of your task and select the operating system of your windows vps from drop-down.

    General Settings

  3. Now Go to Trigger tab and schedule the time of reboot.

    Set triggers

  4. Now set the reboot action with adding command C:\Windows\System32\shutdown.exe with add argument /r and click ok.

    Set Action

That’s all.This VPS is now set to reboot on every weekend.



Leave a Reply