Getting MAC Addresses and Their Vendor Name in PowerShell

0

MAC address, a media access control address, is a unique identifier assigned to network interfaces for communications on the physical network segment. It’s a network address on TCP/IP network that normally we don’t care about that much. But when it comes to waking up an offline computer on the same network we do need to know it before doing it.

There are many ways to get to know your local or remote computers’ MAC address but here let’s check to see how we can get this data from a PowerShell console.

To get local network adapters’ MAC address, simply use the comlet getmac which also returns a list of network protocols associated with each address.

Windows PowerShell getmac 600x221 - Getting MAC Addresses and Their Vendor Name in PowerShell

You can also get a remote computer’s MAC addresses as well, with the switch /C.

getmac /s computername

You get a much detailed output with the switch /V.

getmac /s computername /v

Need a different output layout, try the switch /FO with the options of “Table”, “List”, or “CSV”.

getmac /s computername /v /fo list

Windows PowerShell getmac options 600x295 - Getting MAC Addresses and Their Vendor Name in PowerShell

Digging deeper, do you know that based on the MAC addresses we collected we can actually identify their network vendors. All you need is the official IEEE vendor list that you can download or call up from your PowerShell script.

The script below will download the vendor list and save it in your home directory.

$url = 'http://standards.ieee.org/develop/regauth/oui/oui.txt'
$outfile = "$home\vendorlist.txt"
Invoke-WebRequest -Uri $url -OutFile $outfile

Windows PowerShell 2014 10 02 14 22 24 600x210 - Getting MAC Addresses and Their Vendor Name in PowerShell

then take the first 3 octets, such as E8-39-35, and do a search against the downloaded vendor list.

Windows PowerShell 2014 10 02 14 28 00 600x245 - Getting MAC Addresses and Their Vendor Name in PowerShell

Heck, it even finds HP’s address, though not sure whether it’s current or not.

/credit goes to PowerShell/

LEAVE A REPLY

Please enter your comment!
Please enter your name here