@echo off
::
:: scan for customer radios (airbridge) and get name/mac/ip
::
:: my valid subnet args include 21, 22, 23, 24 (which correspond to 10.0.21.0/24, etc)
:: e.g., FOR %q IN (21 22 23 24) DO call pingabx %q public
::
:: blame: shardy@@methownet.com
::
:: uses: snmpget.exe/snmpset.exe from freeware ucd-snmp
::       sleep.exe from one of the reskits
::       perl

setlocal

:: see AT76C510.mib for definitions

set    MACAddr=enterprises.410.1.1.2.3
set abNameAddr=enterprises.410.1.2.1.10

set _subnet=21
if not %1.==. set _subnet=%1
set _cmty=private
if not %2.==. set _cmty=%2

del out%_subnet%.* >nul 2>&1
del ABClients%_subnet%.out >nul 2>&1
for /l %%i in (2,1,254) do (
  start "pingABx %_subnet%.%%i" cmd.exe /c "(snmpget  -OqvT 10.0.%_subnet%.%%i %_cmty% %abNameAddr%   )>>out%_subnet%.%%i"
  )
echo wait...
sleep.exe 20
for /f "tokens=4" %%a in ('dir ^|find " 0 "') do del %%a

for %%a in (out%_subnet%.*) do  for /f "tokens=*" %%b in ('perl -pe "s/.*\[(.+)\].*/$1/;s/\.*\n//" %%a') do  (
  for /f %%m in (' snmpget  -Oqv 10.0.%_subnet%%%~xa %_cmty% %MACAddr% ^| perl -pe "s/\"^(.*?^) *\"/$1/;s/ /:/g;" ') do (
    echo 10.0.%_subnet%%%~xa:	%%m %%b >>ABClients%_subnet%.out
    )
  )

type ABClients%_subnet%.out

endlocal