If you manage computers on a network, you will often encounter situations where you have to shut down, restart, or log off a Windows PC on the network. As a beginner, these simple tasks might seem complicated, but Windows offers several built-in tools to manage your system remotely. This blog post will extensively discuss how to shut down/restart/log off a Windows PC on the Network.
How to Shutdown Restart Logoff Windows PC on Network
1. Shutdown and restart through Windows Remote Shutdown Command
- First, connect to your remote desktop with the required credentials.
- Next, press Windows Key + R to open RUN, type cmd, and press Enter.
- Now, to shutdown or restart your Windows remote PC, run the following commands.
Shutdown: shutdown /s /m \\<RemoteComputerName> /t <TimeInSeconds> /c “<Comment>”
Restart: shutdown /r /m \\<RemoteComputerName> /t <TimeInSeconds> /c “<Comment>”
In both these commands, make sure to replace variables like RemotecomputerName with the PC name, TimeInSeconds to add a delay before the shutdown, and keep it 0 for immediate action.
Also, you can replace <Comment>” with any message to display on the remote computer; however, this is optional.
Here’s an example of the whole code: shutdown /s /m \\pc2 /t 0 /c “Shutting down for maintenance”. Remember, /s stands for shutdown, while /r stands for restart.
2. Shutdown and restart through Powershell
- Press Windows Key + R to open RUN, type powershell, and press Enter.
- Run the following commands to shutdown or restart your remote PC:
Shutdown: Stop-Computer -ComputerName <RemoteComputerName> -Force -Credential (Get-Credential)
Restart: Restart-Computer -ComputerName <RemoteComputerName> -Force -Credential (Get-Credential)
To shut down your remote PC via powershell, we will be using the Stop-Computer cmdlet, and for restart, we will use the Restart-Computer cmdlet. Just make sure to replace the <RemoteComputerName> with the actual computer name.
3. Through Psexec command
You can also use PsExec, a lightweight command line tool from Microsoft Sysinternals Suite. Using this, you can execute several processes and commands on remote Windows systems. Here is how to use it for shutdown or restart:
- First, download Microsoft Sysinternals Suite on your remote computer.
- Extract the file and open a Command Prompt in the folder where psexec.exe is located.
- Next, run the below commands to shutdown or restart your remote PC:
Shutdown: psexec \\<RemoteComputerName> -u <Username> -p <Password> shutdown /s /t <TimeInSeconds> /c “<Comment>”
Restart: psexec \\192.168.1.100 -u admin -p password123 shutdown /s /t 0 /c “System maintenance shutdown.”
In this command, you will need to replace <RemoteComputerName> with the name or IP address of the remote system. You will also need to replace <Username> and <Password> for the specific user.
4. Log off through quser command
You can use the quser command to learn about user sessions on a remote or local machine. Plus, you can use the command to log off any user remotely. Here’s how:
- First, open the command prompt and run the following command: quser /server:<RemoteComputerName>
- This will give you an output of all the users logged in. From here, you will need to note down the session ID.
- Now to make any user logoff, you need to run the following command: logoff <SessionID> /server:<RemoteComputerName>
Just make sure to replace these two <SessionID> and <RemoteComputerName> variables with the accurate details.
Those were a few quick methods to shut down, restart, or log off a Windows PC on a network. However, you might need administrative privileges and additional configuration to execute these commands, such as enabling PowerShell remoting.