Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Azure Trigger PowerShell Function to lookup Vendor/Manufacturer. Associated Blog Post can be found here https://blog.darrenjrobinson.com/an-azure-powershell-trigger-function-for-mac-address-vendor-manufacturer-lookup/
$requestBody = Get-Content $req -Raw | ConvertFrom-Json
$query = $requestBody.query
$query
if ($query)
{
# LOAD MAC Address to Vendors PSObjects
$vendors = Import-Clixml -Path "D:\home\site\wwwroot\YOURAZUREFUNCTION\Vendors.xml"
$output = $null
$response = $null
if ($query.Contains("-")) {
$response = $vendors | Select-Object | Where-Object {$_.hex -eq $query}
if ($response){
$output = (Get-Culture).textinfo.totitlecase($response.vendor.tolower())
}
}
else {
$response = $vendors | Select-Object | Where-Object {$_.base16 -eq $query}
if ($response){
$output = (Get-Culture).textinfo.totitlecase($response.vendor.tolower())
}
}
}
if ($output) {
$output
Out-File -Encoding ASCII -FilePath $res -inputObject $output
} else {
$output = "MACAddress Vendor not found"
$output
Out-File -Encoding ASCII -FilePath $res -inputObject $output
}
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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.