Sometimes you may need to restart a remote computer if you were a Windows administrator. How to reboot remote computers? In this post, MiniTool will show how to reboot computer remotely with PowerShell/CMD/Remote Desktop Protocol.
About Windows Shutdown/Restart Commands
As you might know, Windows systems come with a series of shutdown/restart command lines that you can use to shut down/restart a remote computer. For instance, the Restart-Computer cmdlet allows you to restart computer remotely.
To shut down a computer, you can open the Windows Command Prompt/PowerShell and type shutdown, and press Enter. If you want to know more command lines about the showdown command, type shutdown / and hit Enter. Here we list the most commonly PowerShell remote reboot/shutdown commands:
- /s: Shut down the computer
- /r: Restart the computer
- /m \\computer: Specify the target computer
- /t xxx: Set the time-out period before shutdown to xxx seconds
- /l: Log off
- /c “comment”: Comment on the reason for the restart or shutdown
Do you know what Exchange Online PowerShell is? How to connect to Exchange Online PowerShell? This post provides you with a full guide to achieve that.
How to Shut down or Restart a Remote Computer
Here we will show you how to perform the CMD/PowerShell restart computer. Let’s start trying.
Way 1. Shut Down or Restart a Remote Computer with PowerShell
To show you how to Powershell restart computer specifically, we summarize several command examples. In these examples, we will be on PC1 and perform the remote shutdown/restart operations on PC2.
Firstly, follow the steps below to open the elevated Command Prompt window on the PC1.
Step 1. Type cmd in the Search box, and then right-click the Command Prompt app and select Run as administrator.
Step 2. In the elevated Command Prompt window, you can refer to the following examples to shutdown/ restart remote computer CMD.
Example 1: Shutdown or restart a remote computer:
- shutdown /s /m \\pc2 (shutdown)
- shutdown /r /m \\pc2 (restart)
Example 2: Restart a remote computer with a custom message:
shutdown /m \\pc2 /c "The IT department has initiated a remote restart on your computer"
Then you will receive a pop-up message on the remote computer with the custom message.
Example 3: Immediately restart a remote computer countdown:
shutdown /r /m \\pc2 /t 0
If you want to Powershell remote reboot with a longer countdown, you can specify the seconds such as /t 60.
Example 4: Log user off on the remote computer:
shutdown /l /m\\pc2
Way 2. Shut Down or Restart a Remote Computer with CMD
There are several common examples of the PowerShell reboot remote computer. Compared with CMD, the PowerShell restart computer commands have fewer options and there’s no option to restart the remote computer with a custom message or a countdown.
To shut down or reboot remote computer PowerShell, you need to open the elevated PowerShell window like open the Command Prompt window, and then run the following commands.
Example 1: PowerShell restart computer remotely:
Restart-Computer -ComputerName REMOTE_COMPUTER_NAME -Force
This command will immediately restart the remote command and the Force option will force a restart even if the user is logged on.
Example 2: PowerShell shut down a computer remotely:
Stop-Computer -ComputerName REMOTE_COMPUTER_NAME -Force
Example 3: PowerShell shut down two computers remotely:
Stop-Computer -ComputerName "Server01", "Server02"
Example 4: PowerShell restart a list of computers remotely:
If you want to restart multiple computers remotely, just list all these computers that you want to restart in a text file and add it to the PowerShell command.
restart-computer (get-content c:\work\computers.txt)
Way 3. Shut Down or Restart a Remote Computer with the Remote Desktop Protocol
If you are running a Windows 10 Pro, Education, or Enterprise on each computer, then the Remote Desktop Protocol (RDP) feature can help you restart computer remotely. Here’s a tutorial for you.
Step 1. Press Win + I keys to open the Settings window and select System.
Step 2. In the Settings window, select Remote Desktop from the left panel.
Step 3. Toggle on the switch next to Enable Remote Desktop from the right side of the window.
Step 4. Click on Confirm in the prompted window.
Step 5. Click on the Start menu at the left bottom corner of your screen and select Shut down or Restart.
What does the PowerShell copy-item mean? How to copy a file with PowerShell? Now, this post explains 8 common examples for the PowerShell copy file operation.