Is this issue still a thing/ is it back? i have been stuggling all of a sudden with a script i use to keep up to date and no matter what i do if i try to access docs with powershell it errors out.
Powershell Invoke-WebRequest to https://docs.microsoft.com
Hi guys,
we tried to invoke a webrequest with powershell to https://learn.microsoft.com (https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date) to get the versionnumber table for exchange via ps1 script. It worked fine since today.
Now all invoke-webrequest to learn.microsoft.com without basic parsing seems to be blocked with powershell running into an endless loop without error. Anyone else got problems like this?
Thanks!
Windows for business | Windows Server | User experience | PowerShell
12 answers
Sort by: Most helpful
-
-
Paul 1 Reputation point
2022-06-10T08:38:01.303+00:00 Its still working for me. Here is a snippet of the code I use if it helps you:
$HTML = Invoke-WebRequest -Uri "https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date"
$parsedcontainer = $HTML.ParsedHtml.getElementsByTagName('tr') | Where {$.innerHTML -notmatch "Preview" -and $.innerHTML -match "Semi-Annual Enterprise Channel" -and $_.innerhtml -match "2102"} | select innerhtml
$latestversion = $parsedcontainer.innerhtml
$String = $latestversion
$Regex = [Regex]::new("(?<=13801)(.*)(?=<)")
$Match = $Regex.Match($String)
$latestversion = '16.0.13801' + ($Match.value.Split('<') | Select -First 1)