Remote computer administration refers to any method of controlling a computer from a remote location anywhere in the world. Remote administration among other things includes the ability to shut down or restart a computer. If you have two or more computers connected to your home or office network, or even outside your network, you can use one of them to shut down the others remotely. Windows, Linux, and Mac computers all support this feature.
If you are using Windows, you’ll need to pre-configure the remote computer to be able to support remote shut down. Once this is set up, you can easily perform the shutdown with a simple Terminal command from any computer. This article will show you various methods you can use to shut down or restart a remote computer.
Shutdown remote computers using PsExec command
PsExec is a utility from Microsoft that allows you to execute commands on a remote computer. For example, you can use PsExec to shut down and restart a remote computer, manage processes on the remote computer, and much more, without having to manually install client software—you only need to copy PsExec onto your executable path. However, the tool only works when the following criteria are met:
- File and Printer Sharing is enabled on both the local and remote computer
- Both computers belong to the same Workgroup or Domain network
- You know the password to the administrator’s account on the remote computer
Before using PsExec to execute remote commands, you need to download and extract the files from PsTools on the computer that will be running the remote commands. Follow the steps below to complete the setup process:
Open the folder where the extracted files are located, and from the navigation bar at the top of the folder, erase what’s there and enter cmd. This will open Command Prompt in that folder so that you can run commands through PsExec.
With Command Prompt now open to the folder that contains PsExec.exe, you can start entering commands on the remote machine.
Enter the following commands to execute cmd on the target remote machine (using the IP address or computername): psexec \192.168.1.50 cmd
Once completed, you should be able to enter commands as if you were sitting in front of the remote computer. Now, you should be able to shut down or restart the remote computer using the following commands as the case may be:
shutdown /s Shut down the computer.
reboot /r Reboot the computer.
Shut down a remote computer using net use command
The net use command enables you to connect to, remove, and configure connections to shared resources such as mapped drives and network printers. You can also use it to shut down or reboot a remote computer. It does this using various parameters and switches. The command is available from the Command Prompt in Windows desktop (Windows 10/8/7) and server (server 2008/2016/2019) operating system.
To use the net use command to shut down or restart a computer over the network, you need to disable the User Account Control for remote executions in the registry by following the steps below:
- First, open and run Command Prompt as administrator.
- Type the following command to disable the User Account Control for remote executions and press the Enter key:
reg add HKLM\Software\Microsoft\windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
Once completed, your device will be open to receive commands remotely from authenticated users. The syntax to shutdown a remote computer is as shown below:
shutdown /s /m \REMOTE-PC /t TIME /c “COMMENT” /f
- /s is used to shutdown the computer.
- /r is used to reboot the computer.
- /m \computer is used to specify the target computer
- /t is used to set the time-out period before shutdown
- TIME represents the number of seconds to wait before beginning the shutdown process
- /c is used to print comments to the computer screen before rebooting or shutting down
- COMMENT means the custom dialog you want to send the user
- /f is used to force running applications to close without forewarning users
Now, follow the steps below to shutdown a remote computer with the IP 192.168.1.50 using the above syntax:
- Open and run Command Prompt as administrator
- Type the following command to connect to the Windows built-in Inter-Process Communication share (IPC$) and anonymous user account and a null password, and press Enter: net use \192.168.1.50\IPC$ “” /u: “”
- Confirm the account name located in the remote device and press Enter.
- Confirm the account password and press Enter.
- Type the following command to shut down, consisting of the remote computer, and press Enter:
shutdown /s /m \192.168.1.50 /t 120 /c “This PC will shut down in two minutes for maintenance.” /f
If no one is using the computer, you can use the command below to shut down the device immediately:
shutdown /s /m \192.168.1.50 /t 0 /f
Once these steps are completed, the remote host will power off according to the initiated commands.
Shutdown a remote computer using PowerShell
PowerShell is a cross-platform task automation solution from Microsoft, consisting of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and Mac. PowerShell can be used to perform the shutdown of remote computers in bulk without enabling remote shutdown capability.
The Stop-Computer and Restart-Computer cmdlet are the PowerShell commands to shutdown and restart local and remote computers. The Stop-Computer cmdlet has the -ComputerName switch, through which you can specify a list of systems that require shutdown. Some of the notable parameters for the Stop-Computer command are as follows:
ComputerName: Specifies the computers to shut down. The default is the local computer. The computer name can be the NETBIOS name, IP address, or FQDN (Fully Qualified Domain Name) of one or more computers in a comma-separated list. To specify the local computer, type the computer name or localhost.
Confirm: Prompts you for confirmation before running the cmdlet.
Credential: Specifies a user account that has permission to do this action. The default is the current user. The certificate can be a user name, such as user001 or domain01\user001, or a PSCredential object generated by the Get-Credential cmdlet. If you enter a user name, you’ll be prompted to enter the password.
Force: Forces an immediate shut down of the computer.
WsmanAuthentication: Specifies the mechanism used to authenticate the user credentials when the cmdlet uses the WSMan protocol. The default value is Default. The acceptable values for this parameter are: Basic, CredSSP, Default, Digest, Kerberos, and Negotiate.
Shutdown remote computers: Here’s the syntax to shutdown multiple remote computers using PowerShell cmdlet:
Stop-Computer -ComputerName 192.168.1.50, 192.168.1.51, 192.168.1.52
If someone is currently working on the remote computers, you will get an error. To solve this problem, you can add the -Force key, which will do a forced shutdown as shown below:
Stop-Computer -ComputerName 192.168.1.50, 192.168.1.51, 192.168.1.52 -Force
Shutdown using specified authentication: You may want to shut down a remote computer using specified authentication. This is where the WsmanAuthentication parameter comes into play. In the example below, the WsmanAuthentication parameter specifies using Kerberos to establish a remote connection.
Stop-Computer -ComputerName 192.168.1.50 -WsmanAuthentication Kerberos
Shutdown on behalf of a specific account: If you need to perform a shutdown on behalf of a particular account, then you can use the -Credential switch as shown below, which requires the domain name (domain01), the username (user001), and password when prompted:
Stop-Computer -ComputerName 192.168.1.50 -Credential domain01\user001 -Force
Shutdown multiple computers in a domain: A situation may arise where you are required to shutdown multiple computers in a domain. The Stop-Computer command can easily cope with this task, but first, you need to create a text file containing a list of computers (in a single column) that need to be shut down, and then execute the command as shown below:
$b = Get-Content -Path C:\computers.txt
$c = Get-Credential -Credential Domain01\Admin01
Stop-Computer -ComputerName $b -Force -Credential $c
- Get-Content uses the Path parameter to get a file in the current directory with the list of domain computers. The objects are stored in the $b variable.
- Get-Credential uses the Credential parameter to specify the credentials of a domain administrator. The certificates are stored in the $c variable.
- Stop-Computer shuts down the computers specified with the ComputerName parameter’s list of computers in the $b variable. Next, the Force parameter forces an immediate shutdown. Finally, the Credential parameter submits the credentials saved in the $c variable.
Shutdown as a background job: There may be situations where you wish to shutdown remote computers as a background job. In that case, the background operator & can be used to run the Stop-Computer command as a background job as shown below:
$b = Stop-Computer -ComputerName 192.168.1.50, 192.168.1.51 &
$results = $b | Receive-Job
$results
- The job objects are stored in the $b variable
- The job objects in the $b variable are sent down the pipeline to Receive-Job, which gets the job results
- The objects are stored in the $results variable
- The $results variable displays the job information in the PowerShell console
Shutdown a remote computer using GUI
This method provides a GUI that makes sending the shutdown command to a remote computer across the network more accessible. This is where the shutdown\i command comes into play. This command brings up a graphical dialog that lets you select the remote computer or enter its name or IP address using the Add button. You can then specify whether you want to shut down or restart, including an option to add a comment.
Before you can execute this command, you first need to configure the remote computer to allow remote command executions using the following steps:
Once completed, you can then use the shutdown\i command to shut down or restart multiple remote computers as the case may, using the steps below:
- Press Windows key + R on the keyboard to open the Run dialog
- Type shutdown /i command and click the OK button.
- Click the Add button.
- Enter the computer name or IP address of the remote computer.
- Click the OK button.
- (Optional) Repeat steps No. 4, 5, and 6 to add more computers to the list.
- Use the “What do you want these computers to do” option to select Shutdown, Restart, or Annotate Unexpected Shutdown.
- Check the “Warn user of the action” option to alert the user.
- Use the display warning option to specify how long the warning should display on the screen in seconds.
- Under the “Shutdown Event Tracker” section, use the Option drop-down menu and select why you are shutting down the computers.
- Check the “Planned” option if you want to register the action as planned. Otherwise, the action will register as “Unplanned.”
- In the “Comments” section, type the message you want the user to see—for example, “The PC will shut down in a minute for maintenance.”
- Click the OK button
Once the above steps are completed, the computers in the list will shut down according to your configuration and message.
Shutdown a remote computers using RDP
Remote Desktop Protocol (RDP) is a proprietary protocol developed by Microsoft which provides a user with a graphical interface to connect to another computer over a network connection. To initiate an RDP connection, an RDP client and server software are required at the local and remote computers, respectively. Fortunately, all of these come pre-installed on Windows machines. RDP clients are also available for most versions of macOS, Linux, Android, and iOS. An open-source version is also available.
RDP saves you the headache of configuring and using the command line approach to shutting down and restarting remote computers. However, you may be required to configure port forwarding on your router if the remote computer is outside your network. Follow the steps below to shutdown a remote computer using RDP:
- Type ‘RDP’ in the Windows search bar to locate the RDP app.
- Enter the required login credentials when prompted to proceed further.
- When the connection is established, you can then use your mouse to shut down or reboot your computer, as the case may be.
Shutdown a remote computers using third-party tools
Apart from the built-in shutdown commands and other embedded tools that can be used to shutdown/restart a local or remote computer, there are lots of free and commercial third-party remote administration tools out there that can equally do the job, if not better. In addition, third-party tools are much simpler to configure and use than most built-in tools.
Other systems to try include TeamViewer, TightVNC, LogMeIn, PuTTY, Symantec pcAnywhere, ManageEngine Shutdown / Restart Tool, and a host of others including remote access VPN applications. The only downside is that some third-party tools require their software installed on both local and remote computers.
ManageEngine Free Shutdown / Restart Tool
ManageEngine provides a Free Shutdown / Restart Tool that is part of a GUI system for managing Windows.
To use this tool, follow these steps:
- Download the Free Windows Admin Tools.
- Click on the downloaded file to run the installer. This will add a launch icon to your desktop.
- Double-click on the Windows Admin Tools icon to run the interface.
- Click on Domain Settings in the left-hand panel and click on Add Domain in the main panel.
- Enter AD Domain Controller Admin credentials in the popup screen and click on OK.
- Click on the Manage Computers tab and select a computer from the first column.
- Click on Shutdown / Restart in the second column.
- In the third column of the screen choose Shutdown Now or Restart Now from the Select an option drop-down list.
Click on Execute to perform the action.
Conclusion
We have discussed various methods you can use to shut down or restart a remote computer. While remote computer administration, including the ability to initiate a shutdown or restart, has many legal uses and offers many benefits, there are also security implications.
Cybercriminals may be able to take advantage of the configurations and settings that allow remote administration, as well as existing loopholes to gain remote access to your computer and carry out malicious activities. Therefore, you must adhere to secure remote access practices and ensure that appropriate security measures are in place to prevent security breaches.