[dba-Tech] Automate IP lookup

Jon Tydda jon at tydda.plus.com
Fri Feb 27 18:17:12 CST 2009


I would love to have Vipre on the work network, but it has to be approved by
a bunch of guys in Switzerland who I've not met. I seriously doubt they'd
even entertain the idea for more than ten minutes.

Trend doesn't seem to pick up anything though, we've had some laptops with
Antivirus 2009/2010 on them, and Trend didn't even notice it. I only found
one by accident and scanned it with malwarebytes...


Jon

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of John Bartow
Sent: 28 February 2009 00:08
To: 'Discussion of Hardware and Software issues'
Subject: Re: [dba-Tech] Automate IP lookup

Jon,
Vipre Enterprise has a function to do this - I believe this is what
"Enterprise Console" implies ;o) FYI half price for a competitive upgrade
:o)

Here's a script to ping a subnet. Takes a while and won't work if you have
personal firewalls set to not respond to a ping but I doubt that would be
the case.

HTH
John B
<code starts here>

@ECHO OFF
@TITLE Ping Entire Subnet
@COLOR 2F
@IF NOT "%OS%"=="Windows_NT" GOTO :ERROROS GOTO :BEGIN :BEGIN 
::   SETLOCAL keeps all the variables in this script local to the script. 
SETLOCAL
:: Don't forget to configure these four items. 
::
----------------------------------------------------------------------------
-------------------
SET First_3_Octets=192.168.254
SET Starting_Number=1
SET Ending_Number=254
SET Output_Location=Pings.csv
::
----------------------------------------------------------------------------
--------------------
ECHO Ping Entire Subnet>%Output_Location% Date /T >>%Output_Location% Time
/T >>%Output_Location% ECHO.>>%Output_Location% ECHO PingChecking... 
FOR /L %%i IN (%Starting_Number%,1,%Ending_Number%) DO (SET Last_Octet=%%i)
& (CALL :PingChecker) ECHO Run complete ECHO.>>%Output_Location% ECHO
Processing Complete >>%Output_Location% Time /T >>%Output_Location% START
/normal Notepad.exe %Output_Location% ENDLOCAL EXIT

:PingChecker
SET response= 
FOR /F "tokens=1,2,3 delims=:" %%i in ('ping -n 1
%First_3_Octets%.%Last_Octet%^| find "Reply"') DO (SET response=%%i) 
IF /I "%response%"=="Reply from %First_3_Octets%.%Last_Octet%" (GOTO :Reply)
:: ELSE (GOTO :NoReply)

:Next 
GOTO :EOF 

:Reply
ECHO %First_3_Octets%.%Last_Octet%, reply
ECHO %First_3_Octets%.%Last_Octet%, reply>> %Output_Location%
GOTO :EOF

:NoReply
ECHO %First_3_Octets%.%Last_Octet%, no response
ECHO %First_3_Octets%.%Last_Octet%, no response>> %Output_Location%
GOTO :EOF

:ERROROS 
ECHO This script requires the Windows NT O/S. Script will exit now. 
PAUSE 
CLS 
EXIT

_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com




More information about the dba-Tech mailing list