Having ecxperienced a few problems similar to those in this thread, http://www.code-crafters.com/forum/viewtopic.php?f=6&t=2265 with AMS freezing/locking up every now and then, I wanted a way to automatically stop and then re-start the AMS service, as doing this manually seems to clear the issue.
The simplest way to do this is via a .bat file which can then be run as a scheduled task.
There seems no simple way of pausing execution of a .bat file, and in the end I settled on downloading the small sleep.exe from http://www.computerhope.com/dutil.htm
Whether this will work on Windows Server 2007 I don't know, but it does on 2003.
The name of the AMS service can be gotten from opening the Services management console within Windows, and examining the properties window of the AMS service. I don't know, but I guess it may differ from the below depending on what version of AMS you are running.
My .bat file ended up as follows - works a treat:
REM ---------
net stop CODE_CRAFTERS_AMS2_SERVICE
REM Pause a few seconds before restarting
REM this method not tested
REM PING 1.1.1.1 /N 5 /W 1000 > NUL
REM nor this either
REM TYPE NUL | CHOICE.COM /N /CY /TY,10 >NUL
REM this has! Put sleep.exe in same location and use
SLEEP 10
net start CODE_CRAFTERS_AMS2_SERVICE
REM ---------