Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MAC Address OUI Vendor Manufacturers as PowerShell Objects. Associated Blog Post can be found here https://blog.darrenjrobinson.com/an-azure-powershell-trigger-function-for-mac-address-vendor-manufacturer-lookup/
# Get MAC Vendor List http://standards.ieee.org/develop/regauth/oui/oui.txt
$uri = "http://standards.ieee.org/develop/regauth/oui/oui.txt"
$output = "C:\temp\MAC Address\vendors.txt"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Uri $uri -Method GET -OutFile $output
$vendors = @()
if (test-path -Path $output) {
$vendorlist = Get-Content -Path $output
if ($vendorlist.Length -gt 15300) {
foreach ($vendor in $vendorlist) {
if (($vendor.Contains("(hex)")) -or ($vendor.Contains("(base 16)"))) {
$arrVDetails = $vendor.Split("`t")
if (!$vendorName) {
$vendorName = $arrVDetails[2]
}
if ($vendor.Contains("(hex)")) { $hex = $arrVDetails[0].Split(" ")}
if ($vendor.Contains("(base 16)")) { $base16 = $arrVDetails[0].Split(" ")}
if ($hex -and $base16 -and $vendorName) {
write-host -ForegroundColor blue "$($base16[0]) $($hex[0]) $($vendorName)"
$vendorDetails = [PSCustomObject]@{
vendor = $vendorName
base16 = "$($base16[0])"
hex = "$($hex[0])"
}
$vendors += $vendorDetails
$arrVDetails = $null
$hex = $null
$base16 = $null
$vendorName = $null
}
}
}
}
}
$vendors | Export-Clixml -Path "C:\temp\MAC Address\Vendors.xml"
<#
Sample Objects
vendor base16 hex
------ ------ ---
Apple, Inc. F0766F 40-CB-C0
Apple, Inc. 40CBC0 40-98-AD
Apple, Inc. 4098AD 6C-4D-73
Apple, Inc. 6C4D73 C4-84-66
Apple, Inc. C48466 B8-63-4D
Apple, Inc. B8634D 50-32-37
Apple, Inc. 503237 D4-61-9D
Apple, Inc. D4619D B0-48-1A
Apple, Inc. B0481A 98-9E-63
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.