Nmedia - Fotolia


How to shut down and restart a remote computer

Shutting down or restarting a computer remotely is often a necessary process. Explore the multiple ways to do so, using methods such as GUI and CLI commands.

Remote operations can vastly simplify maintenance for applications, security, operating systems and even system hardware support tasks -- especially when dealing with countless PCs and other endpoints in the environment. IT administrators can save tremendous time and frustration by using computer remote access capabilities to shut down or restart a remote computer.

Windows is well suited to the remote control of PCs on the local network. Administrators must first configure remote systems to allow such remote control, then initiate the actual shutdown or restart commands to the selected systems. Fortunately, Windows 10 offers several convenient ways to accomplish these tasks.

Enable remote shutdown or restart

By default, computers are typically not configured for remote control, so administrators will need to check and configure each system that must be controlled remotely. Fortunately, this is a one-time process.

Start by identifying the name of each computer. The easiest way to identify each system is to click Start, type sysinfo into the Search bar, and click the System Information app entry in the search results. This starts the System Information app, which outlines a complete suite of technical details about the system. The system name is located near the top, often the fifth entry. For this exercise, the name of the system is "desktop-nu8vl79." As an alternative, administrators can click Start, Settings, System and About. The device name is located in the Device specifications area.

Now check and configure the system to accept remote control. There can be several procedures here depending on how the remote system is already configured.

Activate remote registry services. The computer must allow remote registry connections. Click Start, type services.msc into the Search bar, and click the Services app entry in the search results. Scroll down the list of services and locate the Remote Registry entry. Right-click the Remote Registry entry and then select Properties.

Remote registry
Activate the remote registry.
Startup type
Select the startup type.

Set the Startup type to Automatic, click Apply, and then click Start to activate the service. The Service status note should switch from "Stopped" to "Running."

Open a firewall for WMI. Remote control uses Windows Management Instrumentation (WMI) commands, so each remote system will need to allow WMI through the firewall. Click Start, type Allow an app through Windows Firewall in the Search bar, and click the corresponding entry in the search results. When the Allowed apps dialog opens, scroll down to locate the Windows Management Instrumentation (WMI) entry. Highlight the entry and click the Change settings button. Be sure that the WMI checkbox is checked, along with the Private box, and then click OK.

Allow Windows Management Instrumentation through the firewall.

Tweak the registry. At this point, administrators at a management computer can try initiating a shutdown and restart of a remote computer. If the attempted commands return an error such as Failed to open registry.(997), then the remote system will require one additional configuration change in the Registry in order to allow the remote control.

Accessing and making changes to the Windows system Registry carries risks and errors that may impair the system. Only experienced administrators should attempt changes to the system Registry, which should be backed up before proceeding.

Open the Registry Editor by clicking Start, typing regedit into the Search bar, and selecting the Registry Editor from search results. If asked to allow the app to make changes to the system, click Yes to proceed.

Using the menu at the left, double-click the "HKEY_LOCAL_MACHINE" folder, double-click the "SOFTWARE" folder, locate and double-click the "Microsoft" folder, locate and double-click the "Windows" folder, locate and double-click the "CurrentVersion" folder, locate and double-click the "Policies" folder, and then click to highlight the "System" folder.

Registry editor
Make changes to the Registry.

Right-click the "System" folder, select New and choose a DWORD (32-bit) Value. This places a new blank entry in the System folder. Name the new entry LocalAccountTokenFilterPolicy and press Enter. Now double-click the new policy entry and set the value from 0 (zero) to 1 (one). Click OK to save the change and close the Registry Editor.

IT admins may need to manually restart the remote system once they make these configuration changes. Admins may need to repeat these preparations for each computer that they will remotely control.

Shut down or restart remote computer using GUI

Once IT has properly configured a remote computer to accept remote shutdown or restart commands, an administrator can initiate those commands from another computer elsewhere on the local network. IT can handle remote actions through a convenient Windows GUI as well as a granular command line interface (CLI).

The remote shutdown dialog.
Remote shutdown

Click Start, type shutdown -i into the Search bar, and select the corresponding Run command from the search results. A CLI will open, along with a Remote Shutdown Dialog.

Start by entering the names of the target computer(s) to be remotely restarted or shut down. For this example, click Add and enter the name located above which was desktop-nu8vl79. If there are multiple target computers, click Add again and continue adding other target systems to the list.

If the computers on the LAN are all administered by Active Directory, administrators can click the Browse button instead and easily select desired target computers from an available list. If Active Directory is not in place, IT must enter target computers manually, though administrators can copy and paste a text file list into the Add dialog to save time.

Now select the desired action from the dropdown menu which can include Restart or Shutdown. The choice of action will depend on the situation. For example, a regular system restart might be appropriate when new patches or configuration changes are made to the hardware, operating system and so on. A shutdown might be necessary when IT needs to perform actual physical work such as a network adapter upgrade on the target computer.

IT should include a modest delay before executing the action. The default is 30 seconds. The GUI also provides a Shutdown Event Tracker that allows administrators to annotate the action for future reference by including a reason for the action, as well as a custom Comment message that target system users will see. Click OK and the action will initiate.

If the CLI returns an error for one or more of the target systems, such as Failed to open registry.(997) or some other message, chances are that the system referenced in the error has not been properly configured to allow remote control. Recheck the configuration steps in the previous section.

Shut down or restart remote computer using a command line

Administrators may elect to exercise remote shutdowns or restarts using the command line interface instead of the GUI. The CLI provides detailed and granular control over the process using a series of command line switches and options.

To start the CLI, simply click Start, type run into the Search bar, and select Command Prompt from the search results. A small CLI will open. Administrators can find the complete suite of command line switches and options for the shutdown command using the CLI command:

shutdown /?

Administrators can combine command line switches to formulate precise commands that include /r to restart or /s to shut down, /t xxx to stipulate a time delay (a time entry of 0 would be an immediate action), /m \\name to specify the target computer name, and /c "comment" to denote a reason for the action. For this example computer, IT would enter a shutdown with a 30-second delay such as:

shutdown /s /t 30 /m \\desktop-nu8vl79 /c "test shutdown"

Shutdown delay
Delay a shutdown.

If an administrator prefers a 60-second restart rather than a 30-second shutdown, IT should tweak the command line to read:

shutdown /r /t 60 /m \\desktop-nu8vl79 /c "test restart"

If an error appears such as "The entered computer name is not valid or remote shutdown is not supported on the target computer," recheck the target computer's name, and be sure that the target computer is fully configured to support remote actions.

Administrators often prefer to use CLIs because there are more options available, and it is a simple way to create batch files to operate the shutdown command across any desired target systems without the need to repeatedly type complex commands. For example, the shutdown command provides additional options in the CLI such as /l to simply log off the target, /a to abort the action, /h to hibernate the system and so on.

Alert end users

Although system managers can exercise control of remote systems when the need arises, it's important to remember that each remote system is being used by other people -- usually in the midst of their own daily work. Simply restarting or shutting down their system without notice or reason can be highly problematic for users. The remote shutdown and restart capabilities of Windows allow for messages and countdowns that give users vital time to save their work and exit applications before the remote event occurs.

When using the remote shutdown GUI, administrators can opt to warn users of the coming action, provide a delay (in seconds), and even enter a comment that denotes the reason. When using the CLI, administrators can use the shutdown command along with the /t xxx switch to set a delay (in seconds) and the /c "comment" switch to add comment text.

Dig Deeper on Windows OS and management

Virtual Desktop