Instantly share code, notes, and snippets.

Embed
What would you like to do?
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/
# 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