How-to: Schedule a Windows Server reboot

Windows machines all have something in common:  at a given time, they’ll all need to be rebooted.  It’s not that big of a deal when dealing with desktops, but for servers this is a bit more complicated.  People depend on the services / applications hosted by that server.  So, if a server needs a reboot, you’ll probably need to schedule it for a time when it’s “safe” to do so. 

Doing so is pretty simple.  All you need, is access to the server and a moment on which the reboot can be done without co-workers cursing at you for shutting down their precious CRM server.  Here’s how you get the job done:

  1. On the server, open Notepad and type the following:
    shutdown /r /t 30 /d P:0:0

    This command will tell your server to reboot, thirty seconds after the command is executed.  The /d P:0:0 part ensures that the reboot will be registered as a planned reboot.  If desired, you can add a your comments as well; by adding the /c trigger to the command.  Your command would then look like this:

    shutdown /r /t 40 /d P:0:0 /c This reboot is neccesary because it is. 

  2. Save as a .bat file, on a location that you’ll remember.
  3. Go to Start > Accessories > System Tools > Scheduled Tasks
  4. Select “Add Scheduled Task”.  Using the wizard, choose the application you want to execute (the .bat file you just created) and the time it should be executed.  Don’t forget to provide an account with sufficient rights to execute the command / reboot the server. 
  5. Close the wizard.

The planned reboot will now take place when you planned it.

Advertisements