Let's talk about IT!
posts - 2247, comments - 295, trackbacks - 0

My Links


Post Categories


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

The whole Script is published at my GitHub Repo

Why not using PowerShell for that

$URI = ""
$WebRequest = Invoke-WebRequest -URI $URI
$WebRequest | get-member

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 = ""
$WebRequest = Invoke-WebRequest -URI $URI
$WebRequest | get-member

You can get the same behavior, wen using the UseBasicParsing Parameter.

$URI = ""
$WebRequest = Invoke-WebRequest -URI $URI -UseBasicParsing
$WebRequest | get-member

I found this Function to convert a HTML Table - but it relies on that ParsedHtml Attribute

$tables = @($WebRequest.ParsedHtml.getElementsByTagName("TABLE"))
$table = $tables[0]
$MSServicePlan = ConvertFrom-HTMLTable $table

$MSServicePlan | ft "GUID","String ID","Product Name"

$MSServicePlan |  Export-CSV -Path "C:\Temp\licensing-service-plan.csv" -Encoding UTF8 -NoTypeInformation

Andres Bohren

Print | posted on Friday, April 8, 2022 3:13 PM | Filed Under [ PowerShell ]

Powered by:
Powered By Subtext Powered By ASP.NET