1

When trying to run an Invoke-WebRequest in PowerShell, it takes absolutely ages to do anything and then I get a message saying "A script on this page is causing your web browser to run slowly". I wouldn't mind too much, but this is for a auto recurring script which will be unattended and the popup requires the user to pick yes or no.

I've tried -UseBasicParsing but which fixes the speed issue, but for the purpose of the script, I need the HTML parsed.

If I load the website in a normal browser I don't get any issues and I can't find anything that's running slowly on the page.

Is there any way to get it to ignore the scripts when using Invoke-WebRequest as I'm only really interested in the contents of a table on the webpage.

Here's the actual command with URL so you can see if you get the same result:

Invoke-WebRequest https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference

Any help would be appreciated as I'm totally stuck for ideas at the moment!

Here is the popup I get

Blind Trevor
  • 746
  • 2
  • 9
  • 28
  • If I open that url in Firefox, it starts out looking ok, but if you scroll down you can see there is something really screwed up in the tables. You may be better off downloading the [pdf](https://learn.microsoft.com/en-us/azure/opbuildpdf/active-directory/enterprise-users/toc.pdf?branch=live), although the tables in there don't look to good either.. – Theo Jun 12 '22 at 11:33
  • I can't use the PDF because Microsoft update this list all the time and I need up to date information. It's not easy to manually download this regularly as this will eventually end up in an automated Function App. Interestingly - that table is exactly what I'm after - and it doesn't matter how it renders on Firefox because I'm only using the data in PowerShell. – Blind Trevor Jun 13 '22 at 14:58
  • I've just found a link to a CSV, but I'm not sure if this CSV will always be the latest version, based on the URL: https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv – Blind Trevor Jun 13 '22 at 14:59

1 Answers1

0

Same here. I am working right now on solution using HTML Agility pack tool combined with powershell script which is working lighting fast. But in general you can use powershell module PSParseHTML and function ConvertFrom-HTMLTable.