Extract M365 Licensing GUID's and Product names from MS Website
Hi All,
For a Project i wanted to Extract the M365 License and ServicePlan Guids from the Website below
Product names and service plan identifiers for licensing
![](https://icewolffile.blob.core.windows.net/$web/202204/M365_LicensingServicePlan_01.jpg)
The whole Script is published at my GitHub Repo
Why not using PowerShell for that
$URI = "https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference"
$WebRequest = Invoke-WebRequest -URI $URI
$WebRequest | get-member
![](https://icewolffile.blob.core.windows.net/$web/202204/M365_LicensingServicePlan_02.jpg)
As you can see, with PowerShell 7 the Property "ParsedHtml" is missing. It somehow has a dependency to the local installed Browser. So you can't use it on Azure Automation :(
$URI = "https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference"
$WebRequest = Invoke-WebRequest -URI $URI
$WebRequest | get-member![](https://icewolffile.blob.core.windows.net/$web/202204/M365_LicensingServicePlan_03.jpg)
You can get the same behavior, wen using the UseBasicParsing Parameter.
$URI = "https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference"
$WebRequest = Invoke-WebRequest -URI $URI -UseBasicParsing
$WebRequest | get-member![](https://icewolffile.blob.core.windows.net/$web/202204/M365_LicensingServicePlan_04.jpg)
I found this Function to convert a HTML Table - but it relies on that ParsedHtml Attribute
Function Convert-FromHTMLTable
https://github.com/ztrhgf/useful_powershell_functions/blob/master/ConvertFrom-HTMLTable.ps1
https://github.com/ztrhgf/useful_powershell_functions/blob/master/ConvertFrom-HTMLTable.ps1
$tables = @($WebRequest.ParsedHtml.getElementsByTagName("TABLE"))
$table = $tables[0]
$MSServicePlan = ConvertFrom-HTMLTable $table
$table = $tables[0]
$MSServicePlan = ConvertFrom-HTMLTable $table
$MSServicePlan[0]
![](https://icewolffile.blob.core.windows.net/$web/202204/M365_LicensingServicePlan_05.jpg)
$MSServicePlan | ft "GUID","String ID","Product Name"
![](https://icewolffile.blob.core.windows.net/$web/202204/M365_LicensingServicePlan_06.jpg)
$MSServicePlan | Export-CSV -Path "C:\Temp\licensing-service-plan.csv" -Encoding UTF8 -NoTypeInformation
![](https://icewolffile.blob.core.windows.net/$web/202204/M365_LicensingServicePlan_07.jpg)
Regards
Andres Bohren
![](https://icewolffile.blob.core.windows.net/$web/logos/powershell_logo.png)