About Author

Mar 3, 2015

Scheduling Automatic Restart of Windows 7

One of the lessons I have learnt with server administration is that after a while of running tomcat servers, the system can get really sluggish from all the "living objects". One of the solutions for this is to do a daily scheduled reboot of the server to keep the system fresh and performing at its best (of course you also need to fix the reason as to why objects are not being pushed into garbage collection).

So, here is how you create a scheduled restart for Windows machines (This was tested for Windows 7):

Start Notepad,

type c:\windows\system32\shutdown.exe -F -R

Save the file as "AutoRestart.bat" somewhere on disk

Now, Launch Task Scheduler.

Click Action and select Create Basic task.

Type AutoRestart (or others you want) in the Name box and click Next.

Select Daily and click Next

Type the time you want to restart the computer and click Next.

Select Start a program and click Next.

Click Browse and navigate to where you saved AutoRestart.bat, select the AutoRestart.bat file and click Next.

Click Finish.

To test if your auto-restart works, go back to task scheduler and when you see the list of scheduled tasks, right click on AutoRestart and select run.