REM * Reboot a machine with a Message in
REM 5 minutes
echo Start Checking %1
SET bDEBUG=1
ping -n 2 -l 200 %1
IF %ERRORLEVEL%==1 GOTO BAD
c:\windows\system32\shutdown.exe -r -f -m \\%1 -t 300 -d up:125:1 -c "Please SAVE Your work. In 5 minutes, this machine will reboot for maintenance (Msg time: %time%)"
GOTO GOOD
:BAD
IF "%bDEBUG%"=="1" ECHO %1,Failed,%date%,%time%
GOTO EXIT
:GOOD
IF "%bDEBUG%"=="1" ECHO %1,Good,%date%,%time%
GOTO EXIT
:EXIT
echo Stop Checking %1
@echo off
REM
SET iNumSecondsToPause=3600 REM Reboot a Server every 60 mins
FOR %%f IN (XENAPP01,XENAPP02,XENAPP03,XENAPP04) DO
(
CALL c:\crousescripts\RebootAMachine.bat %%f
REM By using CHOICE, we can simulate a pause at
REM %iNumSecondsToPause% seconds
C:\Windows\System32\choice.exe /C Y /D Y /T %iNumSecondsToPause%
)