Here’s a quick snippet to get the IP, MAC address and Vendor using PowerShell in Windows with the native arp -a
command and curl
. It is based on accessing my MAC lookup tool.
$arpOutput = arp -a
foreach ($line in $arpOutput) {
if ($line -match '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+([a-fA-F0-9:-]{17})') {
$ip = $matches[1]
$mac = $matches[2]
$vendor = curl https://techish.net/mac/$mac
Write-Output "IP: $ip, MAC: $mac, Vendor: $vendor"
}
}
Note: You could do a quick ping sweep of the network you’re on so that the arp cache is fresh:
for /l %x in (1,1,254) do @ping -n 1 -w 25 192.168.0.%x | find /I "bytes="
Note: I have setup a script you can use with PowerShell to do a scan and output the data in comma delimited format.
irm https://techish.net/mac/scan | iex
You can save to a CSV using something like this
irm https://techish.net/mac/scan | iex | out-file scan.csv -encoding UTF8
You could also output to clipboard
irm https://techish.net/mac/scan | iex | clip