ridicurious.com
Powershell

Get MAC Vendor using PowerShell

Introduction to ‘Get MAC Vendor using PowerShell’:

Yesterday while troubleshooting a network issue, I realized that if I can know the vendor of a MAC Address, then I could understand if it’s a Dell Router, a VMWare virtual NIC or a Dell server then maybe it will make life a bit easy, like in the following example.

MAC Vendor

The Idea and Making it work:

    1. MAC addresses are stored/burned on the device during the manufacturing process and are designed to not to be modified.The first 6 digits (24 bits) of a MAC Address is called as ‘Prefix’, which are Manufacturers bits registered in IEEE database unique to a vendor, somewhat like in below format –and next 6 digits are Device unique identifiers, following are 3 formats used to represent a MAC address –
      • MM:MM:MM:SS:SS:SS
      • MM-MM-MM-SS-SS-SS
      • MMM.MMM.SSS.SSS

      So if my MAC Address  is ’48-4D-7E-E6-A8-47′ then the first 6 digits (Prefix) can be easily extracted like

    2. Now I want the list of Vendors registered for every such Prefix, but how to get it?
      Ok, during my graduation days we read somewhere that MAC prefixes are registered at IEEE (Institute of Electrical and Electronics Engineers), So how about checking their website first.After some searching on their website, I found MACAddress OUI (Organisationally Unique Identifier) file with Vendor-Prefix mappings in a CSV format and I downloaded it.
    3. Once you have the information, filter out all unnecessary things and store them in a CSV or JSON format, so that it can be easily uploaded/downloaded from a Publically accessible Github repository.I scoured and sanitized the file to reduce the size by 3 times so that it’s quicker in downloads and Lookups. Later uploaded it in CSV format to a public GitHub repo here, from where it could be downloaded to any machine.
    4. Write a Powershell function that can
      • Web request above mentioned public Github URL and downloads the content in a reference file.
      • Look up the MAC prefix from the content of reference file, and display the respective Vendor/OrganizationFollowing is the PowerShell function to get above done
    5. Make sure when the Powershell function runs for the first time, it creates a local copy of content in a File at a static location, which could be accessed to get MAC vendor prefix information locally for all Future function calls by avoiding the Web request which is slower.I Took care of Local copy part in my PowerShell function like in the screenshot below

Running the Function:

You can run the function like in the below screenshot.

Please Note –

Hope you’ll find the script useful and Thanks for reading, Cheers! 🙂

Subscribe to our mailing list

* indicates required

Related posts

Powershell Tip : Parsing HTML from a local File or a String

Prateek Singh
7 years ago

Programmatically Scroll Internet Explorer with PowerShell

Prateek Singh
7 years ago

New Book Announcement! – PowerShell Guide to Python

Prateek Singh
6 years ago
Exit mobile version