David Williams Technical


Endpoint Management & Deployment – MDM Management – Scripting – Cyber Security Engineering – Application Configuration & Deployment

How to Restart a PC from PowerShell

Standalone Command

Open PowerShell as an Administrator and type the command to restart a PC:

Restart-Computer %PC Name%

or

Restart-Computer -ComputerName %PC Name%

Note: A user cannot be logged in whilst running this command. The output shows an error.


From a Text File

Create a text file containing a group of PC names. Save it locally or on the Network.

Open PowerShell as an Administrator and type the command to restart a PC:

Get-Content -Path %Path to Text File% | Restart-Computer

Note: A user cannot be logged in whilst running this command. The output shows an error.

If someone is logged onto the PC add -Force to the end of the command