Powershell Invoke-WebRequest to https://docs.microsoft.com

Fischer, Matthias 6 Reputation points
2021-03-24T12:16:28.217+00:00

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
0 comments No comments
{count} votes

12 answers

Sort by: Most helpful
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2021-03-24T12:41:21.48+00:00

    Hi @Fischer, Matthias ,

    here i tried the Invoke-WebRequest and got a response:

    Invoke-WebRequest -URI https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date  
    

    81137-image.png

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


  2. Rich Matheisen 47,901 Reputation points
    2021-03-24T14:39:35.907+00:00

    I get the same result . . . it just hangs. Doesn't respond to Ctrl+C or any other attempt to kill it.

    Adding "-Verbose" to the cmdlet showed this:

    PS C:\Users\richm> Invoke-WebRequest -URI https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date -verbose
    VERBOSE: GET https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date with 0-byte payload
    VERBOSE: received -1-byte response of content type text/html

    0 comments No comments

  3. Rich Matheisen 47,901 Reputation points
    2021-03-24T14:54:11.777+00:00

    Interesting. Assigning the result of that Invoke-WebRequest to a variable works. You can access the RawContent, RawContentLength , Content, Headers, etc. However, the parsing of the data fails by entering a loop. E.g., $x.Links or $x.ParsedHTML never complete.

    The BaseResponse property is this -- note the ContentLength value!

    IsMutuallyAuthenticated : False  
    Cookies                 : {}  
    Headers                 : {Request-Context, X-Datacenter, X-Frame-Options, x-content-type-options...}  
    SupportsHeaders         : True  
    ContentLength           : -1  
    ContentEncoding         :  
    ContentType             : text/html  
    CharacterSet            : ISO-8859-1  
    Server                  :  
    LastModified            : 3/24/2021 10:52:46 AM  
    StatusCode              : OK  
    StatusDescription       : OK  
    ProtocolVersion         : 1.1  
    ResponseUri             : https://learn.microsoft.com/en-us/officeupdates/update-history-microsoft365-apps-by-date  
    Method                  : GET  
    IsFromCache             : False  
    
    0 comments No comments

  4. Paul 1 Reputation point
    2021-03-25T12:13:39.27+00:00

    I am glad we're not alone in seeing this behavior. I will monitor and update this if I hear anything.


  5. Paul 1 Reputation point
    2021-03-26T09:24:24.387+00:00

    Guys, I can't take the credit (although we did punt it to MS as a question if you want to give me kudos!) but it appears that MS have fixed this issue.

    Good news indeed.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.