Advertisement
RenabaReD

disconnections.bat

Mar 3rd, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.86 KB | None | 0 0
  1. @echo off
  2. echo === DNS and LAN connectivity monitoring started : %date% %time% ===
  3. echo === DNS and LAN connectivity monitoring started : %date% %time% === >> dc.txt
  4. :int
  5. ping 8.8.8.8 -n 1 > NUL &rem This IP is Google's DNS server, replace it by the one you need to test
  6. if %errorlevel% EQU 0 (
  7.         set global=1
  8. ) else (
  9.         set global=0
  10. )
  11.  
  12. ping 192.168.1.1 -n 1 > NUL &rem Replace this IP by your router address
  13. if %errorlevel% EQU 0 (
  14.         set local=1
  15. ) else (
  16.         set local=0
  17. )
  18.  
  19. ping -n 4 127.0.0.1 >nul &rem only used as a 4s delay
  20.  
  21. if %global% EQU 0 (
  22.     if %local% EQU 1 (
  23.         echo DNS Dysfunction : %date% %time%
  24.         echo DNS Dysfunction : %date% %time% >> dc.txt
  25.     )
  26. )
  27. if %local% EQU 0 (
  28.     echo LAN Dysfunction : %date% %time%
  29.     echo LAN Dysfunction : %date% %time% >> dc.txt
  30. )
  31. if %global% EQU 1 (
  32.     echo OK : %date% %time%
  33. )
  34. goto int
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement