The shutdown command-line tool to restart Windows and Restart-Computer cmdlet in PowerShell is used to restart windows or reboot the windows without any GUI tool.
Windows administrators periodically need to reboot computers, remote computers. Using command line restart or PowerShell Restart-Computer remotely without scripting.
In this blog post, we will discuss how to restart or reboot the Windows operating system using the command line (cmd) or PowerShell.
Restart Windows with Shutdown Command Prompt
One of the easiest ways to restart or reboot your Windows computer is through Command Prompt Shutdown command-line tool.
To restart the Windows operating system with shutdown command in Command Prompt, use these steps:
- Click on the Search icon in the Windows taskbar
- Enter cmd in the search field
- Click on the Open menu
You can use the “Run as Administrator” option to open a command prompt in administrator privileges.
- Use the following command to restart the computer
shutdown /r
- Press Enter
Use the shutdown /r cmd command to restart computer.
After you complete the above steps, the computer will reboot.
Cool Tip: How to get a list of PowerShell Modules!
How to restart computer immediately with shutdown command
Shutdown /r command-line tool restart windows after 1-minute delay as default timer.
Use the /t parameter to specify the immediate reboot of the windows using the below command
shutdown /r /t 0
In the above command,
shutdown /r /t 0 specify to restart the windows after 0 seconds ( immediately)
If you want to cmd reboot computer after 30 seconds or after specific seconds interval time, use /t parameter to specify reboot timer in seconds as given below
shutdown /r /t 30
The above command will restart the computer after 30 seconds.
Cool Tip: How to get the last boot time of the computer using PowerShell!
Restart Remote Computer using Command Prompt
You can use the Shutdown /r /m command-line tool to restart the remote computers using the command prompt.
/m parameter in shutdown command specify remote machine name.
Use the below command to reboot the remote computer using cmd
shutdown /r /m \\SHELL-PC101 /t 60
The above command will restart the remote machine name SHELL-PC101 after 60 seconds delay.
You can force a restart of the remote computer with comments for the target machine using the below command
shutdown /r /m \\SHELL-PC101 /t 60 /c "Please save all of your documents"
In the above command,
It will display a standard windows dialog box on a remote machine with messages as
“You are about to sign out” and followed by “Please save all of your documents”
Shutdown cmd will reboot the remote computer after 60 seconds delay.
Cool Tip: How to use test-connection to ping a list of computers!
Restart Windows with Restart-Computer PowerShell Command
Restart-Computer PowerShell command is used to restart local or remote computers.
To reboot the local computer using PowerShell restart-computer command, use these steps:
- Click on the Search icon in the Windows taskbar
- Enter cmd in the search field
- Click on the Open menu
You can use the “Run as Administrator” option to open a command prompt in administrator privileges.
Type the below command to restart the computer using PowerShell
Restart-Computer
Restart-Computer cmdlet in PowerShell reboots the local computer.
Cool Tip: Event Id 1074 – System restart or shutdown!
How to Restart Remote Computer using PowerShell?
Use Restart-Computer cmdlet in PowerShell to restart one or more remote computers as given below
Restart-Computer -ComputerName SHELL-PC01, SHELL-PC02, localhost
In the above PowerShell script to restart multiple remote computers,
Restart-Computer cmdlet has the ComputerName parameter. We have specified multiple remote computer names to reboot using the command.
Cool Tip: How to use mkdir to create a directory!
Conclusion
I hope the above article is helpful to understand different ways to restart windows or reboot windows using command prompt and using PowerShell.
Shutdown /r command-line is used to restart/reboot local or a remote computer using a command prompt.
You can use /t parameter to delay the reboot of the computer let’s say 30 seconds delay, use /t 30
Restart-Computer cmdlet in PowerShell is used to reboot local or remote computers. You can use the -force parameter to forcefully reboot the computer.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.