---
updatedAt: 2025-08-14T13:54:11.000Z
agentTools:
  siteIndex: https://developer.n-able.com/llms.txt
  projectIndex: https://developer.n-able.com/n-sight/llms.txt
---

# Allows to continually ping the host ang log to a file whenever connectivitiy is lost

```shell VB Script
@echo off
:: --
:: -- Switch AUTOSETUP ON or OFF 
:: --
set AUTOSETUP=ON

:: - If AUTOSETUP=ON : script will use pre-defined test-addresses below
:: - If AUTOSETUP=OFF : user will be asked to choose test-addresses
:: 						Example addresses below are used for quick-selection


:: --
:: -- Edit test-addresses below (use IPs or DNS-names)
:: --
set TESTADDRESS1=www.nu.nl
set TESTADDRESS2=www.grift-it.nl
set TESTADDRESS3=192.168.0.1
set TESTADDRESS4=127.0.0.1
set TESTADDRESS5=8.8.8.8


:: --
:: ------------------------------------------------------------------
:: --





:: --
:: -- DO NOT EDIT BELOW THIS LINE
:: --
set Ptotal1=0
set Perrors1=0
set Ppercentloss1=0
set Ptotal2=0
set Perrors2=0
set Ppercentloss2=0
set Ptotal3=0
set Perrors3=0
set Ppercentloss3=0
set Ptotal4=0
set Perrors4=0
set Ppercentloss4=0
set Ptotal5=0
set Perrors5=0
set Ppercentloss5=0

set Key="HKEY_CURRENT_USER\Control Panel\International"
for /F "tokens=3" %%a in ('reg query %Key%  ^| find /i "sLang"') do set LANG=%%a

set NOW=NU
if %LANG%==NLD set NOW=%date:~11,2%%date:~6,2%%date:~3,2%-%time:~0,2%%time:~3,2%
if %LANG%==ENU set NOW=%date:~12,2%%date:~4,2%%date:~7,2%-%time:~0,2%%time:~3,2%

set NOW=%NOW: =0%

ECHO -- -- --         Connection Test v1.8 - by Grift - IT B.V.          -- -- --
ECHO -- --                            ( 2015 )                               -- --
ECHO -- --                                                                   -- --

IF /i [%AUTOSETUP%]==[ON] (
ECHO -- --         Maakt gebruik van automatische configuratie               -- --
ECHO -- --                                                                   -- --
)

IF /i NOT [%AUTOSETUP%]==[ON] (
  set /P INVOER1="-- -- Geef test-adres 1 (toets ENTER voor: %TESTADDRESS1%): " %=%
  set /P INVOER2="-- -- Geef test-adres 2 (toets ENTER voor: %TESTADDRESS2%): " %=%
  set /P INVOER3="-- -- Geef test-adres 3 (toets ENTER voor: %TESTADDRESS3%): " %=%
  set /P INVOER4="-- -- Geef test-adres 4 (toets ENTER voor: %TESTADDRESS4%): " %=%
  set /P INVOER4="-- -- Geef test-adres 5 (toets ENTER voor: %TESTADDRESS5%): " %=%

  IF NOT [%INVOER1%] == [] set TESTADDRESS1=%INVOER1%
  IF NOT [%INVOER2%] == [] set TESTADDRESS2=%INVOER2%
  IF NOT [%INVOER3%] == [] set TESTADDRESS3=%INVOER3%
  IF NOT [%INVOER4%] == [] set TESTADDRESS4=%INVOER4%
  IF NOT [%INVOER5%] == [] set TESTADDRESS5=%INVOER5%
)


IF [%TESTADDRESS1%] == [] (
  ECHO.
  ECHO Geen gegevens gevonden voor: test-adres 1
  ECHO.
  ECHO Ten minste 1 test-adres nodig om uit te voeren
  PAUSE
  EXIT
)


ECHO -- --                                        
ECHO -- --        Zie %TESTADDRESS1%_%NOW%.log voor details  
ECHO -- --                                                                   -- --
ECHO -- --           Druk CTRL + C om de test te stoppen.                    -- --
ECHO -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


ECHO -- -- --         Connectie Test v1.8 - door Grift - IT B.V.          -- -- -- >%TESTADDRESS1%_%NOW%.log
ECHO -- --                            ( 2013 )                               -- -- >>%TESTADDRESS1%_%NOW%.log
ECHO -- --                                                                   -- -- >>%TESTADDRESS1%_%NOW%.log
ECHO -- --            Log gestart op %DATE% at %TIME%            -- -- >>%TESTADDRESS1%_%NOW%.log
ECHO -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log

ECHO -- Test de volgende adessen: >>%TESTADDRESS1%_%NOW%.log
IF NOT [%TESTADDRESS1%] == [] ECHO - %TESTADDRESS1% >>%TESTADDRESS1%_%NOW%.log
IF NOT [%TESTADDRESS2%] == [] ECHO - %TESTADDRESS2% >>%TESTADDRESS1%_%NOW%.log
IF NOT [%TESTADDRESS3%] == [] ECHO - %TESTADDRESS3% >>%TESTADDRESS1%_%NOW%.log
IF NOT [%TESTADDRESS4%] == [] ECHO - %TESTADDRESS4% >>%TESTADDRESS1%_%NOW%.log
IF NOT [%TESTADDRESS5%] == [] ECHO - %TESTADDRESS5% >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log

ECHO -- Starting test: %DATE% at %TIME% >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log

:TEST1
IF [%TESTADDRESS1%] == [] GOTO :TEST2
set /a Ptotal1=Ptotal1 + 1
PING -n 1 %TESTADDRESS1%|find "bytes=" >NUL
IF NOT ERRORLEVEL 1 (
   goto :TEST2
) ELSE (
   set /a Perrors1=Perrors1 + 1
   ECHO %DATE% at %TIME% - ping %TESTADDRESS1% failed >>%TESTADDRESS1%_%NOW%.log
   goto :FAILURE1
)


:TEST2
IF [%TESTADDRESS2%] == [] GOTO :TEST3
set /a Ptotal2=Ptotal2 + 1
PING -n 1 %TESTADDRESS2%|find "bytes=" >NUL
IF NOT ERRORLEVEL 1 (
   goto :TEST3
) ELSE (
   set /a Perrors2=Perrors2 + 1
   ECHO %DATE% at %TIME% - ping %TESTADDRESS2% failed >>%TESTADDRESS1%_%NOW%.log
   goto :FAILURE2
)


:TEST3
IF [%TESTADDRESS3%] == [] GOTO :TEST4
set /a Ptotal3=Ptotal3 + 1
PING -n 1 %TESTADDRESS3%|find "bytes=" >NUL
IF NOT ERRORLEVEL 1 (
   goto :TEST4
) ELSE (
   set /a Perrors3=Perrors3 + 1
   ECHO %DATE% at %TIME% - ping %TESTADDRESS3% failed >>%TESTADDRESS1%_%NOW%.log
   goto :FAILURE3
)


:TEST4
IF [%TESTADDRESS4%] == [] GOTO :TEST5
set /a Ptotal4=Ptotal4 + 1
PING -n 1 %TESTADDRESS4%|find "bytes=" >NUL
IF NOT ERRORLEVEL 1 (
   goto :TEST5
) ELSE (
   set /a Perrors4=Perrors4 + 1
   ECHO %DATE% at %TIME% - ping %TESTADDRESS4% failed >>%TESTADDRESS1%_%NOW%.log
   goto :FAILURE4
)


:TEST5
IF [%TESTADDRESS5%] == [] GOTO :EINDE
set /a Ptotal5=Ptotal5 + 1
PING -n 1 %TESTADDRESS5%|find "bytes=" >NUL
IF NOT ERRORLEVEL 1 (
   goto :EINDE
) ELSE (
   set /a Perrors5=Perrors5 + 1
   ECHO %DATE% at %TIME% - ping %TESTADDRESS5% failed >>%TESTADDRESS1%_%NOW%.log
   goto :FAILURE5
)


:FAILURE1
set /a Ptotal1=Ptotal1 + 1
PING -n 1 %TESTADDRESS1%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
   set /a Perrors1=Perrors1 + 1
   ECHO -- failed on 2nd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal1=Ptotal1 + 1
PING -n 1 %TESTADDRESS1%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors1=Perrors1 + 1
  ECHO -- failed on 3rd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal1=Ptotal1 + 1
PING -n 1 %TESTADDRESS1%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors1=Perrors1 + 1
  ECHO -- failed on 4th attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ppercentloss1=Perrors1 / (Ptotal1 / 100)
ECHO ---- %TESTADDRESS1%: Pings / Failed / Percent loss :: %Ptotal1% pings / %Perrors1% fails / %Ppercentloss1% percent loss >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log
goto :TEST2


:FAILURE2
set /a Ptotal2=Ptotal2 + 1
PING -n 1 %TESTADDRESS2%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
   set /a Perrors2=Perrors2 + 1
   ECHO -- failed on 2nd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal2=Ptotal2 + 1
PING -n 1 %TESTADDRESS2%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors2=Perrors2 + 1
  ECHO -- failed on 3rd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal2=Ptotal2 + 1
PING -n 1 %TESTADDRESS2%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors2=Perrors2 + 1
  ECHO -- failed on 4th attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ppercentloss2=Perrors2 / (Ptotal2 / 100)
ECHO ---- %TESTADDRESS2%: Pings / Failed / Percent loss :: %Ptotal2% pings / %Perrors2% fails / %Ppercentloss2% percent loss >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log
goto :TEST3


:FAILURE3
set /a Ptotal3=Ptotal3 + 1
PING -n 1 %TESTADDRESS3%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
   set /a Perrors3=Perrors3 + 1
   ECHO -- failed on 2nd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal3=Ptotal3 + 1
PING -n 1 %TESTADDRESS3%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors3=Perrors3 + 1
  ECHO -- failed on 3rd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal3=Ptotal3 + 1
PING -n 1 %TESTADDRESS3%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors3=Perrors3 + 1
  ECHO -- failed on 4th attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ppercentloss3=Perrors3 / (Ptotal3 / 100)
ECHO ---- %TESTADDRESS3%: Pings / Failed / Percent loss :: %Ptotal3% pings / %Perrors3% fails / %Ppercentloss3% percent loss >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log
goto :TEST4


:FAILURE4
set /a Ptotal4=Ptotal4 + 1
PING -n 1 %TESTADDRESS4%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
   set /a Perrors4=Perrors4 + 1
   ECHO -- failed on 2nd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal4=Ptotal4 + 1
PING -n 1 %TESTADDRESS4%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors4=Perrors4 + 1
  ECHO -- failed on 3rd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal4=Ptotal4 + 1
PING -n 1 %TESTADDRESS4%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors4=Perrors4 + 1
  ECHO -- failed on 4th attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ppercentloss4=Perrors4 / (Ptotal4 / 100)
ECHO ---- %TESTADDRESS4%: Pings / Failed / Percent loss :: %Ptotal4% pings / %Perrors4% fails / %Ppercentloss4% percent loss >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log
goto :TEST5


:FAILURE5
set /a Ptotal5=Ptotal5 + 1
PING -n 1 %TESTADDRESS5%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
   set /a Perrors5=Perrors5 + 1
   ECHO -- failed on 2nd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal5=Ptotal5 + 1
PING -n 1 %TESTADDRESS5%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors5=Perrors5 + 1
  ECHO -- failed on 3rd attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ptotal5=Ptotal5 + 1
PING -n 1 %TESTADDRESS5%|find "bytes=" >NUL
IF ERRORLEVEL 1 (
  set /a Perrors5=Perrors5 + 1
  ECHO -- failed on 4th attempt >>%TESTADDRESS1%_%NOW%.log
)
set /a Ppercentloss5=Perrors5 / (Ptotal5 / 100)
ECHO ---- %TESTADDRESS5%: Pings / Failed / Percent loss :: %Ptotal5% pings / %Perrors5% fails / %Ppercentloss5% percent loss >>%TESTADDRESS1%_%NOW%.log
ECHO. >>%TESTADDRESS1%_%NOW%.log
goto :EINDE


:EINDE
goto :TEST1


```

```json Response Example
{"success":true}
```

# SCRIPT