How To Restart Computer with PowerShell

Windows offers you many different ways to restart the computer. It can be done with the Win + X menu, with the Start Menu, with the console tool shutdown and even with the classic Shutdown dialog.  Let's see one more method. Today, we will see how to restart your computer using PowerShell.

To restart your PC with PowerShell, you need to open it first. You have several ways to run it in Windows 10. For example, you can use Search (Cortana).

Open PowerShell in Windows 10 by using search
Open the Start menu or switch to the Start screen by pressing the "Win" key on the keyboard. Start typing "powershell": windows 10 run powershell from search

Click Windows PowerShell in the search results or just press Enter to run it.

If you wish to open it as administrator, select it in search results and press Ctrl+Shift+Enter or right click it in search results and choose Run as Administrator.
powershell-open-as-admin

Refer to the article All ways to open PowerShell in Windows 10 to learn all the possible ways to open PowerShell.

Now, type the following command:

restart-computer

This cmdlet will restart your computer immediately.

PowerShell Restart Computer

Also, it can be used to restart several computers at the same time. Very useful!

PowerShell Restart Several Computers

The syntax is as follows:

Restart-Computer -ComputerName "Computer1", "Computer2", "Computer3"

The next command restarts the Computer1 remote computer and then waits up to 10 minutes (600 seconds) for Windows PowerShell to be available on the restarted computer before it continues.

Restart-Computer -ComputerName "Server01" -Wait -For PowerShell -Timeout 600 -Delay 2

The Delay argument determines how often, in seconds, Windows PowerShell queries the service that is specified by the For parameter to determine whether it is available after the computer is restarted.

The For parameter defines the behavior of Windows PowerShell as it waits for the specified service or feature to become available after the computer restarts. This parameter is valid only with the Wait parameter.

The Wait command line argument Indicates that this cmdlet suppresses the Windows PowerShell prompt and blocks the pipeline until all of the computers have restarted. You can use this parameter in a script to restart computers and then continue to process when the restart is finished.

The Restart-Computer cmdlet support a number of other useful options. You can learn more from the article HERE.

You might be interested in reading the following articles:

All ways to restart and shutdown Windows 10

Create Shutdown, Restart, Hibernate and Sleep Shortcuts in Windows 10

How to perform an emergency restart of Windows 10

 

 

2 thoughts on “How To Restart Computer with PowerShell

  1. Robert Shiffman

    Good idea. Here’s a shortcut : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe restart-computer
    The shortcut could be assigned a hotkey.

    Reply
    1. Sergey Tkachenko Post author

      Great idea! Thanks for sharing.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

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