Dave Finds

How to Restart or Shutdown remote computers using PowerShell

If you are a system administrator you will likely control lots of computers physically and remotely. Due to Covid-19 most of the companies have to shut down and forced to request their employees to work remotely from their home and this becomes the most difficult task for system administrators to control all the remote computers. Without a doubt, restart is the half solution for all the IT-related problems but for the remote PC when we lose the RDP or VNC control there is much we can do to control the PC and if we are likely we can still access the PC through PowerShell or cmd script. Now we will check the best possible method to shut down or restart a PC remotely using PowerShell.

Restart the remote computer using PowerShell

The downside of using the PowerShell script is you don’t have as many options as the shutdown command. When you are restarting and shutdown the PC you cannot prompt users with a custom message or provide a countdown.

You can use the below examples to restart or shutdown computers with PowerShell.

Example 1: Use Powershell to restart a computer a single computer:

This command will immediately restart a remote computer. When you use the -Force option it will force a restart of the PC even if a user is logged on.

Restart-Computer -ComputerName REMOTE_COMPUTER_NAME -Force

Example 2: Use PowerShell to restart a list of computers:

If you have several computers to restart. Just list all the computers you want in a text file and add that to the PowerShell command from a local computer as shown below:

restart-computer (get-content D:\computer\remotecomputerslist.txt)

Shutdown remote computer using Powershell

Example 1: Use PowerShell to shutdown a computer:

This command will shutdown a remote computer. Use the -Force to force a shutdown even if a user is logged on.

Stop-Computer -ComputerName REMOTE_COMPUTER_NAME -Force

Example 2: Use PowerShell to shutdown down two computers:

Using the same stop-computer command we can shutdown the multiple computers, you just have to add the list of computer names as shown in the below example.

Stop-Computer -ComputerName "Server01", "Server02"