News

Monday, July 16, 2012

Get list of IP Addresses for mutliple computers at once

REM Saves as PingEM.bat in C:\PingMachines\
REM Exports IP Addresses to C:\PingMachines\IP_Adresses.txt
@echo off
set fnm=%CD%\computers.txt
set lnm=%CD%\IP_Adresses.txt

if exist %fnm% goto Label1

echo.
echo Cannot find %fnm%
echo.
Pause
goto :eof

:Label1
echo PingTest STARTED on %date% at %time% > %lnm%
echo ================================================= >> %lnm%
echo.
for /f %%i in (%fnm%) do call :Sub %%i
echo.
echo ================================================= >> %lnm%
echo PingTest ENDED on %date% at %time% >> %lnm%
echo ... now exiting
goto :eof

:Sub
rem echo Testing %1
set state=alive
if errorlevel 1 set state=dead
echo %1 is %state%
ping -n 1 %1 >> %lnm%

No comments:

 
Free Hit Counter