• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 793
  • Last Modified:

Reboot Server Automatically Everyday

Hi All,

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

Fox404
0
fox404
Asked:
fox404
  • 2
1 Solution
 
Pete LongTechnical ConsultantCommented:
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
0
 
Pete LongTechnical ConsultantCommented:
ThanQ
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now