Submitted By: Paul D.S. DiGiorgio

Logs timed-out events to a text file. Requires Now.exe from the Resource Kit.

Visual Basic
Edit|Remove
@Echo off
setlocal

:START

:BLURB
echo.
echo Ping Logger 1.3
echo  by Paul D.S. DiGiorgio - pdsd@yahoo.com
echo   6 June 2002
echo.

if "%1" EQU "" GOTO :USAGE
if NOT "%2" EQU "" GOTO :SETVALUE
set /a StopValue = 9999999
goto :READCOUNTER

:READCOUNTER
echo.
echo Pinging %STOPVALUE% Times
echo.
SLEEP 1
goto :MAIN

:MAIN
set MachineTMP=%1
set /a qCounter = 1
:CountStart
ping -a -n 1 %MachineTMP% |find /i "request timed out" && NOW Request Timed Out >>%MachineTMP%-Errors.txt && NOW
echo %qCounter%
set /a qCounter = %qCounter% + 1
if %qCounter% LEQ %StopValue% goto :CountStart
goto :END

:SETVALUE
set /a StopValue = %2
goto :READCOUNTER

:USAGE
echo Pings a given machine a given number of times.
echo Any timeouts are logged in [machinename]-Errors.txt.
echo.
echo USAGE: PINGLOG [machinename] [repeats]
echo.
echo You must enter a System to PING - Exiting & GOTO :END

:END
endlocal