Last active
March 14, 2025 10:23
-
-
Save brimur/724cdae0ecddbd6ac5b9b58b47cd65d9 to your computer and use it in GitHub Desktop.
Dynamic map of Microsoft SKU to friendly name
This file contains hidden or 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
################################################################## | |
# | |
# Requires Windows PowerShell v2 - v5 | |
# Will not work in PS 7+ due to lack of ParsedHtml functionality | |
# | |
################################################################## | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
$skuPage = Invoke-WebRequest "https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference" | |
# Extract the sku table from the sku page | |
$skuTable = @($skuPage.ParsedHtml.getElementsByTagName("TABLE"))[0] | |
$headers = @() | |
$tableRows = @($skuTable.Rows) | |
$SkuList = @{} | |
$ti = (Get-Culture).TextInfo | |
# For each html row in the html table | |
foreach($row in $tableRows) | |
{ | |
$cells = @($row.Cells) | |
# If we've found a table header, remember its headers | |
if($cells[0].tagName -eq "TH") | |
{ | |
$headers = @($cells | % { ("" + $_.InnerText).Trim() }) | |
continue | |
} | |
# Find headers | |
$license = [Ordered] @{} | |
for($i = 0; $i -lt $cells.Count; $i++) | |
{ | |
$header = $headers[$i] | |
if(-not $header) { continue } | |
$license[$header] = ("" + $cells[$i].InnerText).Trim() | |
} | |
# Add license to hashtable using the string id and converting the product name to capitalised first letter for better presentation | |
$SkuList[$license."String ID"] = $ti.ToTitleCase(($license."Product name").ToLower()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great! Thank you for that, I was trying to get this based on what user has assigned, but still it was not as nice name as in the Office Portal, I haven't known about that one! - https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference