Servers Reboot Script

rem method 1: machines that are part of the domain
sc \\DOMINO01 stop "Lotus Domino Server (LotusDominoData)"
sleep 90
for /F "tokens=3 delims=: " %%H in ('sc \\DOMINO01 query "Lotus Domino Server (LotusDominoData)" ^| findstr " STATE"') do (
if /I "%%H" == "STOPPED" (
rem shutdown -r -m \\DOMINO01 -t 0
)
ELSE IF /I "%%H" == "RUNNING" (
sc \\DOMINO01 stop "Lotus Domino Server (LotusDominoData)"
sleep 120
rem shutdown -r -m \\DOMINO01 -t 0
)
)
sleep 300

rem method 2: machines that are not joined to domain
start psexec \\DOMINO01 -e -h -u DOMINO01\administrator -p PASSWORD net stop "Lotus Domino Server (DLotusDominodata)" && shutdown -r -m \\DOMINO01 -t 0

Leave a Reply

Your email address will not be published. Required fields are marked *