Last active
February 4, 2019 22:01
-
-
Save darrenjrobinson/da0f3077be31cf10a261d79c994baa91 to your computer and use it in GitHub Desktop.
Get a list of NIC Vendors with MAC Addresses. Associated Blog Post https://blog.darrenjrobinson.com/loading-and-querying-data-in-azure-table-storage-using-powershell/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 Vendors\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 | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment