[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Reboot Server Automatically Everyday

Posted on 2005-04-21
Medium Priority
Last Modified: 2012-05-05
Hi All,

I looking for a program which can auto reboot my server everyday. Any Recommendation?

Question by:fox404
  • 2
LVL 57

Accepted Solution

Pete Long earned 100 total points
ID: 13834425
Schedule a Reboot

Recently, Microsoft made the Resource Kit tools and utilities (that come on CD with the Resource Kit) available for download in a new and easy-to-use format.  If you have not already obtained these tools, be sure to see the previous feature which discusses how to download and install them.  Among the myriad of useful tools and utilities is a little command-line utility called Shutdown.exe.  In combination with the AT scheduling service built into NT, this utility allows you to make changes or installations during business hours, and schedule the machine to reboot overnight.

The Shutdown utility has several options, including rebooting or just shutting down, local or remote NT machines, the length of time before rebooting, whether or not to allow applications the chance to save work, etc.  See the second page of this article for the exact syntax.  I created a small batch file called "reboot.cmd" in notepad, using the appropriate switches, so that I didn't accidentally leave anything out.  Here are the contents of that file:

shutdown /L /R /Y /C

When run, this command file will reboot (/R) the local machine (/L) answering "Yes" (/Y) to the question "Are you sure you want a shutdown?[Y/N]" that appears normally when executing the shutdown.exe command.  It will also force all open applications to close (/C), without the opportunity to save any work.  This is OK as far as I'm concerned, because I'm going to close all applications and log out before I go home, after scheduling this command file.

To schedule this command file, I open a command prompt, and type:

at 23:00 "c:\reboot.cmd"

This will cause my machine to execute my reboot.cmd file above, at 11:00 PM.  It will display a warning message on the console screen, and count down 20 seconds (the default) before shutting down and restarting.  Of course, my Schedule service needs to be running in order for the AT command to work.  If I wanted, I could get fancier and use the "Net stop" command with the AT command to stop some services manually just before the reboot, so that I could determine the order and timing of stopping the services.

You should test this on non-production machines and get comfortable with it before using it.  You could also run the command file by hand when rebooting next time, even though you are present, just to see what it looks like.  I usually follow up by glancing through the Event logs afterwards.  Sometimes I find interesting entries such as "The previous shutdown was unexpected." which makes me wonder how clean this utility works.  Just keep in mind that it could be dangerous, particularly with a machine that has very many services running (for instance a machine with MS Exchange Server, or Oracle installed).  In those cases, you probably should schedule the stopping of those services separate from the reboot.  Also keep in mind that the server will not automatically log itself in after rebooting, so anything that you have in the Startup folder will not run until someone logs in.

All those dire warnings aside, this utility has proven itself handy to me time and again, and definitely has a place in an NT Administrator's toolkit.  On the next page you will find the correct syntax for the Shutdown and AT utilities, as well as links to the forum and chat room, if you would like to discuss more about these tools.

From http://windows.about.com/library/weekly/aa012400a.htm
LVL 57

Expert Comment

by:Pete Long
ID: 13844854

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Integration Management Part 2
Screencast - Getting to Know the Pipeline

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question