Q: I want to reboot all the machines in my organization each night at 2 a.m. unless a user wants to cancel it. What's the easiest way to do this without additional software?

John Savill

April 23, 2011

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A: It's fairly easy to create a recurring scheduled task that runs every night at 2 a.m. Within that task, you could do a check for the existence of a file, and if the file exists, skip the reboot and delete the file (so next time it will reboot). If the file doesn't exist, reboot. You could then add a shortcut on your users' desktops that creates the file if they click it. A very basic batch file to check for a file in Public documents could be the following, saved as schreboot.bat.

@echo off
IF EXIST C:UsersPublicDocumentsstopreboot.txt (
del C:UsersPublicDocumentsstopreboot.txt
) ELSE (
echo rebooting in 60 seconds
shutdown /r /t 60
)
exit

For the desktop shortcut, you could save the following one line as NoReboot.bat on each user's desktop.

echo Stop > "C:UsersPublicDocumentsstopreboot.txt"

For help scheduling the daily calling of the task, see this Microsoft site.

For a large number of computers, you could push with a Group policy preference, which is found under Computer Configuration, Preferences, Control Panel Settings, Scheduled Tasks. The scheduled task would just call the schreboot.bat file running as NT AuthoritySystem every day at 2 a.m.

This is just a very high level example and one way. There would be others, and there are more elegant software solutions. I stress that you should take a close look at whether a nightly reboot is really required.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like