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 server.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.domain1.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 /f

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 *