Hooray: IP/Hostname to MAC

Shambler

Supreme [H]ardness
Joined
Aug 17, 2005
Messages
6,419
So, after a bit of digging I found a script which pings a list of IP's or Hostnames, within a text file, and pumps out the associated MAC address to another text file.

Script below:
@ECHO off
if Exist MACResults.txt (DEL MACResults.txt)
for /f "tokens=*" %%I in (MAClist.txt) do call :nbtstatrunner %%I


ECHO nbtstat process complete.
ECHO Please check MACResults.txt for results
pause
goto :eof

:nbtstatrunner
set _mac=Not on LAN
REM nbtstat -a %1
REM reduce the output to just the line containing the MAC address
REM and pull out the third token by using "=" and " " as delimiters
for /f "usebackq tokens=3 delims== " %%m in (`nbtstat -a %1 ^| find "MAC Address"`) do (set _mac=%%~m)

(echo:%1 %_mac%)>>"MACResults.txt"
 
but VB requires more effort than using notepad and renaming a txt file to .bat

i like it
 
If they're on your local subnet you could do this with some ping and arp commands pretty easily. Nbtstat is pretty cool though, I use it a lot at work when trying to determine who's breaking shit.
 
Yep, I looked into nbtstat -r or is it -R, but the address list I have spans multiple subnets.
After some googling, I found the above bat. JOY!
 
but VB requires more effort than using notepad and renaming a txt file to .bat

i like it

I would find this hard to believe considering someone has probably already created a vb script and it would be a matter of right click.. save link as.

But to each his own
 
Yep, I looked into nbtstat -r or is it -R, but the address list I have spans multiple subnets.
After some googling, I found the above bat. JOY!

Nbtstat -a will give you the MAC of a host off your subnet. That script is using it...
 
I would find this hard to believe considering someone has probably already created a vb script and it would be a matter of right click.. save link as.

i clicked this thread and it was right here. googleing for a VB file would require much more effort. not to mention opening an entire new tab! ugh...

;)
 
Back
Top