Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active May 30, 2019 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save darrenjrobinson/9d98a2ef9c52561198c90a0dabb61a32 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/9d98a2ef9c52561198c90a0dabb61a32 to your computer and use it in GitHub Desktop.
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