PowerShell: Using Restart-Computer to restart your Computer and Remote Computers

For restarting your computer,  you can simply click the Start Button and afterwards On/Off. In this article it’s all about Windows PowerShell, so we focus on two commands: Restart-Computer and Stop-Computer.

Restart-Computer (Local Host)

If you want to restart your computer by using PowerShell, then Restart-Computer is your friend. The command does what it promises: Restarting your computer. Please don’t do it yet, I want you to keep on reading my article. Believe me: It will become interesting.


I have a solution for the problem mentioned before. Run Restart-Computer with the parameter WhatIf. The system then only tells you what would happen, if …

Restart-Computer -WhatIf


Or use the parameter Confirm. It’s your choice to press Y or N. 😉


To delay the restart use Start-Sleep. By the way: The Force parameter restarts the Computer even when users are logged on.

Start-Sleep -Seconds 10 ; Restart-Computer -Force


Restart-Computer (Remote Host)

For restarting a remote computer use -ComputerName. Make sure both hosts share the same Active Directory Domain.

Restart-Computer -ComputerName client001 -Force


Restart-Computer (Multiple Hosts)

If it’s the goal to restart all domain-computers (except servers!), run

(Get-ADComputer -Filter 'operatingsystem -notlike "*server*"').Name | Restart-Computer -Force -ErrorAction silentlycontinue


More about this topic see my article Restart all Domain Computers by using PowerShell.


All of the examples above work with Stop-Computer as well.


Have fun playing with Restart and Stop-Computer!

See also

For more remoting action see also

Active Directory: Send Messages to all currently logged on Users (msg.exe)

Microsoft Docs

Restart-Computer: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/restart-computer?view=powershell-5.1

Stop-Computer: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/stop-computer?view=powershell-5.1

3 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.