Restarting a Windows Server from the command line is a core administrative task that helps maintain system stability and resolve issues quickly. In this guide, you’ll learn how to restart a Windows Server using CMD and PowerShell with practical commands and examples.

Prerequisites of CMD Restart Command
Before delving into the process of how to restart a Windows server via command line, ensure the following prerequisites are in place. It's also important to note that when managing Windows dedicated server infrastructure for enterprise server management having a reliable method for restarting your server through the command line can be essential.
-
Administrator Access: Ensure you have administrative privileges or an account with appropriate permissions to execute commands on the server.
-
Command Line Access: Access to the Command Prompt or PowerShell, depending on your preferred method for executing commands.
-
Knowledge of Command Syntax: Familiarity with the appropriate command syntax, such as the shutdown command and its various options (/r for restart, /m \\servername for remote server, etc.).
-
Operating System Version: Verify the specific Windows Server version (e.g., Windows Server 2012, Windows Server 2019) to ensure compatibility with the command syntax and functionalities available for that version.
What to check before restarting a production server
- Notify users or your internal team before rebooting.
- Check active RDP sessions and remote connections and running processes.
- Verify if Windows Update is pending restart.
- Create a backup of your Windows Server or snapshot for critical systems.
- Ensure you are within a maintenance window.
- Know which services must restart after boot.

How to Restart Server from Command Prompt
To restart a Windows Server from the command line, you can use the built-in shutdown command.
-
Access Command Prompt: Open the Command Prompt with administrative privileges by searching for "Command Prompt"," right-clicking, and selecting "Run as administrator."
-
Execute Restart Command: In the Command Prompt window, type the following command and press Enter:
shutdown /r
Immediate Restart Command in CMD
shutdown /r /t 0
This command restarts the server immediately with no delay.
How to Force Restart Windows Server Using CMD
shutdown /r /f /t 0
This forces all running applications to close and restarts the server.Use this option when the server becomes unresponsive or applications are stuck. Be cautious, as it may result in data loss if users have unsaved work. (see Windows Server security best practices)



Advanced Restart Options in CMD (Remote, Delay, Cancel)
The shutdown command provides additional options to customize the restart process according to specific requirements:
Remote Server Restart: To restart a remote server, add the /m \\servername option to the command, replacing "servername" with the appropriate remote server name.
shutdown /r /m \\servername
How to Restart a Remote Windows Server (CMD)
Before restarting a remote Windows Server, make sure the following conditions are met:
- You have administrative privileges on the remote system
- The server is reachable over the network
- Firewall rules allow remote management
- DNS resolution in Windows Server is working correctly


Delayed Restart: This is useful when you need to give users time to save their work or prepare for a scheduled maintenance window. Adding the /t option allows you to set a delay (in seconds) before the restart occurs. For instance, to delay the restart for 60 seconds:
Add a restart comment
You can include a message to notify users about the restart:
shutdown /r /t 300 /c "Scheduled maintenance reboot"
This is especially useful in shared environments where users need to understand why the server is restarting.
shutdown /r /t 60

Common shutdown command parameters
A quick breakdown of commonly used shutdown command options:
- /r → Restarts the server instead of shutting it down
- /t → Sets the delay time before restart (in seconds)
- /f → Forces running applications to close without warning
- /m \\computername → Targets a remote server
- /a → Cancels a scheduled restart

Cancel a scheduled restart
shutdown /a
This command cancels a scheduled restart if the countdown is still active.

|
Command |
Description |
|
shutdown /r |
Restart the system |
|
shutdown /r /t 60 |
Restart with a 60-second delay |
|
shutdown /r /m \\servername |
Restart a remote server |
Restart a Windows Service Without Rebooting the Server
Using Command Prompt
net stop spooler
net start spooler
Using PowerShell
Restart-Service spooler
If only one service is malfunctioning, restarting it is often better than rebooting the entire server.
Restart Windows Server Using PowerShell
Now that you’ve covered CMD methods, let’s explore how to restart a Windows Server using PowerShell. Utilizing PowerShell to restart a Windows server presents another powerful method for system administrators to manage server operations efficiently. PowerShell offers a more robust and script-oriented approach compared to the Command Prompt, enabling greater control and automation capabilities.
Make sure you are using a supported version of PowerShell by checking your PowerShell version before running commands.
How to Restart Windows Server with PowerShell
The primary cmdlet for restarting a server in PowerShell is Restart-Computer. Here's how you can execute a server restart using PowerShell:
-
Launch PowerShell as Administrator: Search for PowerShell in the Start menu, right-click it, and choose "Run as administrator" to open PowerShell with elevated privileges.
-
Execute Restart Command: In the PowerShell window, type the following command and press Enter:
Restart-Computer
This command is ideal for automation scripts and managing multiple servers in enterprise environments.

This command initiates an immediate restart of the local system.
Additional Options and Customizations
The Restart-Computer cmdlet offers additional parameters to enhance flexibility:
-
Delaying the Restart: You can delay the restart using the -Delay parameter. For instance, to delay the restart for 60 seconds:
Restart-Computer -Delay 60
-
Restarting a Remote Server: To restart a remote server, specify the -ComputerName parameter followed by the name of the remote server.
Restart-Computer -ComputerName "NAME_OF_SYSTEM"
Replace "NAME_OF_SYSTEM" with the name of the remote server.
Restart a remote server with PowerShell
Restart-Computer -ComputerName SERVER01
Force restart using PowerShell
Restart-Computer -Force
The -Force parameter ensures applications close automatically.

Common Errors When Restarting Windows Server (and Fixes)
Access is denied
This usually happens when the command prompt or PowerShell is not running with administrative privileges. Make sure to run it as Administrator.
RPC server unavailable
Check network connectivity, firewall rules, and RPC services.
Command not recognized
Make sure you're using the correct command in the correct shell.

Post-Restart Checklist for Windows Server
After restarting the server, verify that everything is functioning correctly:
- Check if the server is reachable via ping or RDP
- Ensure that critical services are running
- Verify that applications and websites are back online
- Review Windows Event Viewer logs for any startup errors
- Confirm Windows Update status
- Verify that scheduled tasks and background services have resumed correctly
Wrapping Up
We’ve reached the end of our guide on how to restart Windows server command line. In summary, mastering the shutdown command in Command Prompt and the Restart-Computer cmdlet in PowerShell provides system administrators with essential tools for restarting Windows Servers across multiple versions. These commands offer flexibility, allowing immediate restarts, delayed reboots, and remote server management.
In this guide, we covered how to restart Windows Server using both Command Prompt and PowerShell across different versions.
By the way, if you’re curious about how to change the Windows Server password, read our article on this topic as well.


Leave A Comment