Get-MacVendor.ps1
<#PSScriptInfo
.VERSION 1.0.48 .GUID a5be1c11-25c6-4cda-8abd-9fe9a36eb7ac .AUTHOR PM091 .DESCRIPTION Get-MacVendor .COMPANYNAME pez863 .TAGS PSScript #> function Get-MacVendor { <# .Synopsis Resolve MacAddresses To Vendors .Description This Function Queries The MacVendors API With Supplied MacAdderess And Returns Manufacturer Information If A Match Is Found .Parameter MacAddress MacAddress To Be Resolved .Example Get-MacVendor .Example Get-MacVendor -MacAddress 00:00:00:00:00:00 .Example Warning ! ! This may error due to api limits Get-DhcpServerv4Lease -ComputerName $ComputerName -ScopeId $ScopeId | Select -ExpandProperty ClientId | Get-MacVendor #> [CmdletBinding()] param( [Parameter (Mandatory = $true, ValueFromPipeline = $true)] [ValidatePattern("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$")] [string[]]$MacAddress ) begin { $CurrentMac = 0 } process { foreach ($Mac in $MacAddress) { try { $CurrentMac++ Write-Progress -Activity "Resoving MacAddress : $Mac" -Status "$CurrentMac / $($MacAddress.Count)" -PercentComplete $($CurrentMac / $MacAddress.Count * 100) Write-Verbose 'Sending Request to https://api.macvendors.com/' Invoke-RestMethod -Method Get -Uri https://api.macvendors.com/$Mac -ErrorAction SilentlyContinue | Foreach-object { [pscustomobject]@{ Vendor = $_ MacAddress = $Mac } } Start-Sleep -Milliseconds 500 } catch { Write-Warning -Message "$Mac, $_" } } } end { } } |