Servers / Windows OS

How to Remotely Restart Windows Server 2008 R2 and Windows Server 2012 via CMD

Share this post

Each Administrator has experienced at least one time that he can not access the server to restart it, except physically. This can be very frustrating, in this article, I will try to describe how to configure Windows Server 2008 R2 and Windwos Server 2012 for remote restart using the command prompt ( CMD ).

You can find various tutorials of this type on the Internet, but most of them are useless because it is not complete. This remote control option works on Windows Server 2008 and Windows Server 2012 OS. First, you need to go on the Control Panel – Network and Sharing Center, Change Advanced Sharing settingsTurn on file and printer sharing and Turn on network discovery.

Turn On Local File And Print Sharing
Control Panel – Turn On File And Printer Sharing

After that, you type regedit.exe in the run, and after the window opens, go to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System path and create a NEWDWORD file named LocalAccountTokenFilterPolicy and assign it a value of 1 to look like in the picture below.

Local Account Token Filter Policy
Registry Editor – Local Account Token Filter Policy

Since we have done the registry part, it is necessary to define which user will be able to access this type of server control. We do this by defining roles in Group Policy Management. On the Security SettingsLocal PoliciesUser Rights Assignment, we need to edit Force shutdown from a remote system. On the Force shutdown tab from a remote system Properties we need to add a user or group that can access the server shutdown or restart remotely.

Group Policy Management Editor
Group Policy Management Editor – User Rights Assignment

If everything is set up properly, we can start testing. Started Command Prompt with Administrator privileges on a computer that is on the same network as the server and then type the following commands:

net use \\serverip\ipc$ /user:domain\usename password 

After typing the command, press Enter. If everything is OK, you will be seen a message
“The command complete successfully” after which, you can start using the shutdown option. Below you will find the most commonly used options and some examples how to use shutdown.

So for remotely shutting down another machine on your network, you would type into the command prompt the following commands:

shutdown /m \\computerip /r /f

This command will restart the computer and force all programs that are still running to close.

shutdown –m \\computerip –s –f –c “The computer will restart, please save all work.” –t 60

This command will shutdown the computer, force all programs that are running to close, show a message to the user and countdown 60 seconds before it shuts down.

Here are a couple of the most common command:

/s: Shuts down the computer

/r: Restarts the computer

/m \\computeripThe target remote computer to shut down

/f: Forces programs to close immediately

/t: Will wait a certain amount of time in seconds before shutting down or restarting

/c “comment”: This shutdown command option allows you to leave a comment describing the reason for the shutdown or restart.

Related Stories