Schedule Windows Server 2008 R2 to boot and shutdown

31,354

Solution 1

For this you'll probably need a twofer.

  1. A schedule task in the OS firing off shutdown /h /t 2 at your scheduled time.
  2. One of the following:
    1. A BIOS timer to turn on your server.
    2. Leverage Wake-on-LAN and issue a Wakeup packet at the exact time you want that server powered back on.

Solution 2

Shutdown is pretty easy. Create a scheduled task with the following command line:

shutdown /s /t 60 /c "Scheduled shutdown"

That will shut down the computer after popping up a 60-second warning. It will force any stuck programs to close, and will leave a comment in the system event log.

I can't think of any feature of Windows that would let you schedule a startup - that's normally the domain of the BIOS. In a quick test I performed on a Dell workstation, I had to enable "Auto Power On", then set the power-on time. I suspect that some other BIOS's may be less intuitive.

For a more exotic and Rube Goldberg-esque solution, you could enable wake-on-LAN and send a wake-up packet from a neighboring computer. However, I've never been able to make that work myself.

Finally, I have to wonder whether you should even be turning off your server in the first place. The vast majority of servers stay on all the time.

Share:
31,354

Related videos on Youtube

Levi Kovacs
Author by

Levi Kovacs

I am the founder of Acid Media, a software development company. I have founded this company with the vision of making the web a better place!

Updated on September 17, 2022

Comments

  • Levi Kovacs
    Levi Kovacs over 1 year

    I just set up Win Server 2008 R2 + SQL Server 2008 R2, and i'd like to schedule two tasks. One for shutting it down, or putting it to hibernate at a certain time, and one to wake him up. Both tasks should run every day. For booting up the system i tried to set up a scheduled task in the BIOS using the internal clock of the machine, but had no luck.

    Any ideas?

  • AndyN
    AndyN over 13 years
    Also, the box may have remote-admin card (DRAC, iLO) with an SSH interface that could be fed a script for the power-on.
  • Aashraya Singal
    Aashraya Singal over 13 years
    Seems like a reasonable way to save power, if a server's only used during the day and doesn't have great power management.
  • Levi Kovacs
    Levi Kovacs about 13 years
    Thanks! Have to play a little bit more with the BIOS part, but that should be working...