There may be a day when Microsoft realizes that rebooting a server after trivial security updates is too much hassle. Or, that undistinguished, yet business critical, third party application's memory leak just never gets fixed, forcing you to reboot weekly to prevent an outage. As a Windows sysadmin, unless you plan on migrating all your server applications to Unix, you're stuck rebooting your servers periodically. I came up with a way to issue reboots via ad-hoc or a scheduling tool to remotely reboot servers and ensure they are back online.
The Problem
It is trivial to remote reboot a Windows server. Among the alternatives, this task can be accomplished with the Windows' shutdown tool as well as SysInternals' psshutdown tool. However, the only feedback you will get is that the reboot command was issued. You will not know whether the operating system had actually shutdown, rebooted, and come back online.
My Solution
Attached is a VBScript file that will perform the following steps:
Execute the command with the syntax:
cscript /nologo /E:VBScript RebootWait.vbs ServerName
If you use an enterprise scheduling tool, such as TIDAL, you can easily track which reboots failed because the scheduler will reflect an exit code of zero as success, non-zero as error.
Note: The /E:VBScript option was included to cover a rare case when Windows script host does not properly map the .vbs file extension to VBScript language.
Requirements to keep in mind:
Feedback is welcome. Enjoy.
| Attachment | Size |
|---|---|
| RebootWait.zip | 1.23 KB |
Comments
Thanks - just what I needed!
Been a while since you posted this script, but thanks! It's exactly what I was looked for. Long live google.