Skip to content

Instantly share code, notes, and snippets.

@ramiroencinas
Created June 26, 2021 12:46
Show Gist options
  • Select an option

  • Save ramiroencinas/ab07f9586077dbd698460b09fb77166d to your computer and use it in GitHub Desktop.

Select an option

Save ramiroencinas/ab07f9586077dbd698460b09fb77166d to your computer and use it in GitHub Desktop.
# Get Office 365 License Names from GUID
function Get-LicenseNamesByGUID {
param( [string] $GUID )
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$wc = New-Object System.Net.WebClient
$wc.Encoding = [System.Text.Encoding]::UTF8
$src = $wc.downloadstring('https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference')
if ( $src -match "<tr>\n<td>(.*?)</td>\n<td>(.*?)</td>\n<td>$GUID</td>") {
return [pscustomobject]@{
ProductName = $matches[1]
StringID = $matches[2]
}
}
}
# Example for OFFICE 365 E1 (STANDARDPACK)
Get-LicenseNamesByGUID -GUID '18181a46-0d4e-45cd-891e-60aabd171b4e'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment