@ECHO OFF SETLOCAL REM >>> Remember to change these lines to match your environment SET VPNPrivateHost=192.168.1.4 SET VPNPublicHost=66.153.108.159 SET NullHost=10.0.0.254 SET ConnectionName=AltieriVPN SET VPNUser=VPNDialup SET VPNPassword=VPNDial# SET VPNDomain=Altierihomes net time /setsntp:%VPNPrivateHost% :LOOP ECHO Checking VPN Host ping -n 1 %VPNPrivateHost% | find "expired" && GOTO VPNDOWN || GOTO VPNUP :ping -n 1 %VPNPrivateHost% >NUL && GOTO VPNUP || GOTO VPNDOWN :GOTO VPNDOWN :VPNUP ECHO VPN is UP. Waiting 5 minutes before recheck REM Pause for 5 mins before recheck. ping non-existant host for delay PING %NullHost% -n 1 -w 360000 >NUL REM Re-register in DNS to make sure AD/DNS is working IPCONFIG /REGISTERDNS GOTO LOOP :VPNDOWN ECHO VPN is DOWN. Checking VPN Server :ping -n 1 %VPNPublicHost% >NUL && GOTO VSRVUP || GOTO VSRVDOWN ping -n 1 %VPNPublicHost% | find "expired" && GOTO VSRVDOWN || GOTO VSRVUP :GOTO VSRVDOWN :VSRVUP ECHO VPN is DOWN but VPN Server is UP. Attempting reconnection to VPN if "%time:~0,2%" == "%hour%" goto SkipNotify blat C:\windows\chimes.kix -t daryls@packetex.com -server 209.251.36.4 -s "Altieri Inside VPN down" -f AltieriVPN@altierihomes.com set hour=%time:~0,2% :skipNotify rasdial %ConnectionName% /DISCONNECT taskkill /f /im rasautou* rasdial %ConnectionName% %VPNUser% %VPNPassword% /DOMAIN:%VPNDomain% PING %NullHost% -n 1 -w 72000 >NUL GOTO LOOP :VSRVDOWN ECHO VPN Server is DOWN. Waiting 1 minutes before attempting reconnection to VPN REM Pause for 1 mins before recheck. ping non-existant host for delay blat C:\windows\chimes.kix -t daryls@packetex.com -server 209.251.36.4 -s "Altieri Outside VPN down" -f AltieriVPN@altierihomes.com C:\progra~1\kix32 C:\windows\chimes.kix PING %NullHost% -n 1 -w 72000 >NUL GOTO LOOP