Here’s a useful tip if you’ve ever tried performing a remote reboot of a server or workstation running Windows and had the reboot get hung up.
First, some background: you can remotely reboot a machine with the following command:
shutdown /r /m \\computername
Of course, you need to be running as a user with admin rights on the remote machine. Typically, I would follow this with a
ping -i computername to confirm the remote machine has rebooted.
Normally, after a minute or two, you’ll see the machine stop responding to ping, and then eventually come back online. Occasionally, though, if the remote machine is having issues, the reboot can get hung up. If you try the command again, you will get the error:
A system shutdown is in progress.(1115).
What now? Well, you can try cancelling the reboot with
shutdown /a /m \\computername and initiate it again. You might try adding the
/f switch to the
shutdown /r command, which forces all running applications to exit rather than allowing them to save their data. But what if that doesn’t work either?
PSKill to the rescue. This tool is part of the excellent PSTools suite. Just unzip them to a folder in your path (like C:\Windows). We’re going to take advantage of a useful property of the Windows kernel: it depends on certain processes to be running at all times, and if one of these processes is terminated, the system will immediately reboot. One of these processes is winlogon.exe. Just issue this command:
pskill \\computername winlogon
Note that this is nearly the equivalent of pulling the plug on the machine. I wouldn’t recommend using it unless a regular reboot has failed. And of course if the machine isn’t responding to RPC, then nothing is going to work and you’ll just have to walk over there and mash that power button.
Was this helpful? Know of a better way? Leave a comment and let me know!