General Computer Troubleshooting

How to Restart a Computer Remotely From the Command Line

Restart a Windows PC remotely with the shutdown command or PowerShell, plus the permissions needed, how to start Remote Desktop from CMD, and common errors.

On this page
  1. Before you start
  2. Restart with shutdown.exe
  3. Restart with PowerShell
  4. Restart a computer from inside a Remote Desktop session
  5. Start Remote Desktop from CMD
  6. Restart a Windows service instead
  7. Common errors
  8. Cancel a pending restart
  9. Can I remotely reset my PC?

Before you start

You can restart a remote Windows computer from the command line, but it only works under certain conditions. In general you need:

  • An account with administrator rights on the remote computer
  • Network access to it (same network or a working VPN; accessing your home network from outside describes one way to set up a VPN)
  • Remote administration allowed through its firewall and enabled in its settings

Restarting closes running programs, so unsaved work on the remote machine can be lost. If someone may be using it, warn them first. These steps are intended for computers you own or administer.

Restart with shutdown.exe

The built-in shutdown command works from Command Prompt. Open it as administrator and run:

shutdown /r /m \\RemotePC /t 60 /c "Restarting for maintenance"

What the parts mean:

  • /r restarts the computer
  • /m \\RemotePC names the remote computer (its name or IP address)
  • /t 60 waits 60 seconds before restarting; /t 0 restarts immediately
  • /c "..." shows a comment to the user
  • /f forces running applications to close, which risks losing unsaved work, so use it carefully

If you are not using a domain, the remote machine may need extra setup before this works, such as the right firewall rules and permissions for remote shutdown.

Restart with PowerShell

In an elevated PowerShell window you can use:

Restart-Computer -ComputerName "RemotePC" -Credential (Get-Credential)

Add -Force to restart even if users are logged on. Depending on the PowerShell version and how the target is configured, remote management (such as WinRM, or PowerShell remoting) may need to be enabled on the target. Check Microsoft’s documentation for the version you use.

Restart a computer from inside a Remote Desktop session

If you are connected by Remote Desktop, the usual Start menu Restart option may not appear in the same way. Opening Command Prompt inside the session and running the following restarts the remote machine you are connected to:

shutdown /r /t 0

Your session will disconnect, and you can reconnect after a few minutes.

Start Remote Desktop from CMD

Remote Desktop Connection can be launched from the command line:

mstsc /v:RemotePC

Add /admin to connect in administrative mode if needed. Remote Desktop must be enabled on the target computer, and some Windows editions, such as Home, cannot act as the host.

Restart a Windows service instead

Sometimes a full restart is unnecessary and restarting a single service is enough. From an elevated Command Prompt:

net stop ServiceName
net start ServiceName

Or in PowerShell:

Restart-Service -Name ServiceName

For a remote machine, sc \\RemotePC stop ServiceName and sc \\RemotePC start ServiceName are an option, subject to permissions. Be careful with system services, since stopping the wrong one can affect the computer’s stability. The related article on wuauclt.exe commands touches on the Windows Update service in particular.

Common errors

  • Access is denied: The account lacks administrator rights on the remote computer, or remote access policy blocks it.
  • The RPC server is unavailable / network path not found: The computer is off, the name or address is wrong, or a firewall blocks the connection.
  • Command works for one computer but not another: Compare firewall, network profile (public vs private) and account settings.

If you cannot find the cause, the computer troubleshooting guide explains how to narrow it down step by step.

Cancel a pending restart

If you used a delay and change your mind, you can run this on the same computer or by naming it with /m:

shutdown /a

This only works during the countdown period.

Can I remotely reset my PC?

Restarting is different from resetting. A restart simply reboots; a reset reinstalls Windows and removes data. Resetting remotely is normally done through management tools by administrators, and it is not something to attempt without backups.

The complete guide to general computer troubleshooting

Computer Troubleshooting 101: A Step-by-Step Guide to Fixes
Read the guide

Keep exploring

Guides from other topics

All topics →