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).
Click Windows PowerShell in the search results or just press Enter to run it.
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:
This cmdlet will restart your computer immediately.
Also, it can be used to restart several computers at the same time. Very useful!
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: