Enter Search Query:

Four ways to remotely reboot a Windows machine

As a sysadmin you will eventually have to deal with a system that has become unresponsive at the GUI. Fortunately, there are several ways to reboot a Windows PC from another windows PC or server on the network. Here are four of my favorite methods to do this:

1. The shutdown command. This is a command line tool available on most any windows computer which will allow you to remotely reboot any computer joined to an active directory domain. All that’s required are the right credentials.

  • shutdown -r — reboots the system.
  • shutdown -m — specifies a remote computer to be shutdown/restarted/logged off (\computername)
  • shutdown -s — shuts the system down (and powers it off).
  • shutdown -l — logs the current logged on user off the system.
  • shutdown -t xx — where xx is number of seconds to wait untill shutdown/restart/logoff
  • shutdown -i — launches the GUI version of shutdown tool.
  • shutdown -a — aborts the previous shutdown command.

Example:

Force system named opti390.domain.local to reboot now.
shutdown -m \opti390.domain.local -t 0 -r -f

2. Rundll32. This method invokes Windows’ native ability to run system DLL’s which can perform system functions.

  • rundll32.exe user.exe,ExitWindows – shuts down windows completely.
  • rundll32.exe user.exe,ExitWindowsExec – restarts windows.
  • rundll32.exe shell32.dll,SHExitWindowsEx x where x stands for:
  • 0 – logoff
  • 1 – shutdown
  • 2 – reboot
  • 4 – force
  • 8 – power off

3. Powershell restart-computer command.

Example: Reboot server.domain.local
Restart-Computer -Force -ComputerName opti390.domain.local

4. Taskkill and tasklist. Two commands that can be used on a network connected windows system to list and terminate running processes. Taskkill can also be used to reboot a system by killing critical windows processes.

  • tasklist – lists processes currently running
  • taskkill – terminates any process by process number

Example: First you can list the processes on opti390.domain.local (to find out which processes may be hung). Then you can force terminate those processes that are not responding.

tasklist -s \opti390.domain.local
OUTLOOK.EXE (not responding)  4712                            0     11,580 K
LMS.exe                       4008                            0      5,456 K
UNS.exe                       2660                            0      9,152 K
LogonUI.exe                   4404                            1     21,640 K
taskkill -S \opti390.domain.local /U domainusername /P password /PID 4712 /T /F

Example: Find processes that are not responding and terminate all of them.
taskkill /f /fi "status eq not responding"

Example: Reboot opti390.domain.local remotely.
taskkill -S \opti390.domain.local /U domainusername /P password /im lsass.exe /fp

5. BONUS due to popularity. PSExec is a free suite of tools by Sysinternals created for remotely managing windows systems in a business network environment. If your systems are joined to a domain and you have an administrative account, you can use the following to command to remotely reboot a system using PSExec.exe.

First download and extract PSTools.zip to a folder on the system you’re going to be doing the remote rebooting from. Open a command prompt window and change directory to the PSTools folder (you extracted previously).

Example: Remotely reboot a domain joined PC using psexec.exe.
psexec.exe \\opti390.domain.local -u DOMAIN\<domainusername> -p <password> -i -d cmd /c shutdown /r /f /t 1
psexec.exe command options

  • -i Interactive session
  • -d don’t wait for process to terminate

cmd.exe command options

  • cmd windows shell on remote host
  • /c Run command and then terminate from
  • shutdown windows shutdown command
  • /r restart (/h if you want to shutdown)
  • /f Force shutdown, don’t wait for processes
  • /t 1 timeout of 1 second
March 30, 2014

6 comments found

Comments for: Four ways to remotely reboot a Windows machine

  1. Lucia Lampert

    Thanks, David, this is what I was looking for. Thumbs up for your blog – useful and easy to read.

  2. andreas

    Thanks. Saved my day.

  3. Greg

    Thanks. Only thing I had to do is take out the slash before the computer name in #1, and worked like a charm! Thanks again

    1. David Vielmetter

      Thanks for the correction! Appreciate it.

  4. Paweł

    one more 🙂
    WMIC OS Where Primary=TRUE Call Shutdown

  5. Deepak

    5. Via WMI
    wmic /node: os where Primary=’TRUE’ reboot

    6. Using PSTools
    psshutdown.exe -f -r \\

Leave a Reply

Your email address will not be published. Required fields are marked *