Advertisement

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.

Advertisеment

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

 

 

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

2 thoughts on “How To Restart Computer with PowerShell”

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

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.