When you need to reboot a Windows server, you'll occasionally encounter obstacles to making that happen. For instance, if remote desktop services aren't working, how can you reboot the server? Here is a list of tricks I've collected over the years for rebooting or shutting down a system when I can't go to the Start Menu.
Note: These tips are based on an entry in our Servers and Storage blog.
1: Enter the shutdown.exe command
This gem will send a remote (or local) shutdown command to a system. Entering shutdown /r /m \\servername /f /t 10 will send a remote reboot to a system. Shutdown.exe is current on all modern Windows systems; in older versions, it was located on the Resource Kit. For more details, read this Microsoft KB article on the shutdown.exe command.
You can also use the PowerShell equivalent of this command:
Start-Sleep 10 Restart-Computer -Force -ComputerName SERVERNAME
2: Use a hardware management device
If a device such as an HP iLO or Dell DRAC is in use, there is a virtual power button and remote screen console tool to show the system's state regardless of the state of the operating system. If these devices are not configured with new servers, it's a good idea to have them configured in case the mechanisms within the operating system are not available.
3: Hit the virtual machine power button
If the system in question is a virtual machine, all hypervisors have a virtual power button to reset the system. In VMware vSphere, be sure to select the option to Shut Down The Guest Operating System instead of Power Off; this will make the call to VMware Tools to make it a clean shutdown. If that fails, the Power Off button will be the next logical step.
4: Configure a scheduled task through Group Policy
If you can't access the system in any other mainstream way -- perhaps the Windows Firewall is turned on and you can't get in to turn it off -- set a GPO to reconfigure the firewall state and slip in a reboot command in the form of the shutdown.exe command executing locally (removing the /m parameter from the example above). The hard part will be getting the GPO to deploy quickly.
5: Do a console walkthrough
In a situation where the server administrator doesn't have physical access to the system, walking someone through the process may be effective. For security reasons, a single user (domain or locally) can be created with the sole permission of rebooting the server. That person can log on as this temporary user. Then, it is immediately destroyed after the local shutdown command is issued. Further, that temporary user can be created with a profile to run the reboot script on their logon to avoid any interaction by the person assisting the server administrator.
Bonus tip: Try an enterprise system management package
When all else fails... pull the plug
This is definitely not an ideal approach, but it is effective. For physical servers, if a managed power strip with port control is available, a single system can have its power removed and restored.
What other backdoor ways have you used to reboot a Windows server? Share your comments in the discussion.
Rick Vanover is a software strategy specialist for Veeam Software, based in Columbus, Ohio. Rick has years of IT experience and focuses on virtualization, Windows-based server administration, and system hardware.