If you manage servers you have likely come to a point where you finished doing work and got a prompt ‘Your server needs to reboot. Reboot now?’ Well you can’t reboot now… not during business hours. I guess you’ll have to come back tonight… or this weekend, right?
Wrong. Scheduling a reboot is actually pretty easy in Windows. Try this:
- Open Task Scheduler (taskschd.msc).
- In the Actions pane click Create Basic Task…
- Name the task accordingly… Reboot System for example.
- On the Task Trigger page click the radio button One Time
- On the One Time page enter the date and time when you want the server to reboot.
- On the Action page select Start a program.
- On the Start a Program page enter the name of the program shutdown.exe. In the Add arguments box enter /f /r /t 0. This will force the programs to close, restart the server (instead of just turning it off), and set the delay time to 0 seconds.
- Once you have done this your server will reboot at the precise time you want it to, and will come back up.
**NOTE: Don’t forget to check. it is not unheard of in this world for servers to go down and not come back up as they are supposed to!
Do it in PowerShell!
Using PowerShell to script this will allow you to not only save the script, but also run it on remote servers. From Justin Rich’s blog article I found this script: