Windows 10: Powershell WebRequest to Microsoft.com shows Operation Timeout

Discus and support Powershell WebRequest to Microsoft.com shows Operation Timeout in Windows 10 Network and Sharing to solve the problem; I have created the following PowerShell script to test connectivity to a bunch of URLs. The below example is just the meat of the script (full script... Discussion in 'Windows 10 Network and Sharing' started by Mathew_LQOS, Aug 23, 2018.

  1. Powershell WebRequest to Microsoft.com shows Operation Timeout


    I have created the following PowerShell script to test connectivity to a bunch of URLs. The below example is just the meat of the script (full script includes error handling)


    $web1 = $null
    [System.Net.ServicePointManager]:Powershell WebRequest to Microsoft.com shows Operation Timeout :DefaultConnectionLimit = 1024
    [System.Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    $web1 = [net.WebRequest]::Create("https://www.microsoft.com")
    $web1.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299"
    $web1.Timeout = 10000
    $web1.AllowAutoRedirect = 1
    $web1.GetResponse()


    When I run the above test, I always get the following error:

    Exception calling "GetResponse" with "0" argument(s): "The operation has timed out"


    When I change the url from www.Microsoft.com to www.bing.com or any other website (there are a few which have similar behavior), I get the proper output. Removing the timeout or TLS1.2 option yields the exact same result.

    Running Edge with the www.Microsoft.com also works without any issue?


    What is going on?


    Mathew

    :)
     
    Mathew_LQOS, Aug 23, 2018
    #1
  2. rumour6 Win User

    Windows 10 Powershell Invoke-WebRequest “Windows Security Warning ”


    Alright this is one big problem in my opinion that Microsoft needs to address immediately. Steps to reproduce this:
    powershell> Invoke-WebRequest "anywebsitewithcookies.com" (Let's do microsoft.com for example)
    What happens is that you get the following warning:

    Powershell WebRequest to Microsoft.com shows Operation Timeout [​IMG]

    Now this is just horrible. Why Microsoft thinks this is acceptable is beyond me, however in Windows 8.1 there was a workaround. If you went into:
    Control Panel > Internet Options > Privacy

    Powershell WebRequest to Microsoft.com shows Operation Timeout [​IMG]

    You could set cookies to be accepted all the time. This was the only way to get rid of this message and still retain DOM parsing functionality. -UseBasicParsing isn't a solution for me, because I want to use the functionality of what Invoke-WebRequest returns without basic parsing.
    However now in Windows 10 Microsoft decided to get rid of this slider for whatever reason:

    Powershell WebRequest to Microsoft.com shows Operation Timeout [​IMG]

    This problem can be reproduced on every Windows 10 machine and completely destroys how Invoke-WebRequest can be used in a silent scripting environment, because the script hangs and waits for the dialog to be answered. Is there a way to still set Cookies to be accepted for all like in 8.1? I tried every setting in Internet Options in Windows 10, but nothing holds the key. I believe they stopped using it and perhaps moved that setting elsewhere, but I can't find it. Microsoft Edge doesn't have many settings either, so none of them were helpful.
    This is just infuriating. Any help would be highly appreciated, as this will create quite a chaos in many environments.
     
    rumour6, Aug 23, 2018
    #2
  3. Windows 10 Internet Options ~ Powershell Invoke-WebRequest “Windows Security Warning”

    Alright this is one big problem in my opinion that Microsoft needs to address immediately. Steps to reproduce this:

    powershell> Invoke-WebRequest "anywebsitewithcookies.com" (Let's do microsoft.com for example)

    What happens is that you get the following warning:

    Powershell WebRequest to Microsoft.com shows Operation Timeout 7fb5b2df-cff8-4eaa-9f6c-cf5d170e3f34.jpg

    Now this is just horrible. Why Microsoft thinks this is acceptable is beyond me, however in
    Windows 8.1 there was a workaround. If you went into:

    Control Panel > Internet Options > Privacy

    Powershell WebRequest to Microsoft.com shows Operation Timeout 24b434ab-c20c-43ac-9391-f5cc3412ab72.jpg

    You could set cookies to be accepted all the time. This was the only way to get rid of this message and still retain DOM parsing functionality. -UseBasicParsing isn't a solution for me, because I want to use the functionality of what Invoke-WebRequest returns
    without basic parsing.

    However now in Windows 10 Microsoft decided to get rid of this slider for whatever reason:

    Powershell WebRequest to Microsoft.com shows Operation Timeout 291ed2a2-aea0-451a-bce2-f9496478a6c6.jpg

    This problem can be reproduced on every Windows 10 machine and completely destroys how Invoke-WebRequest can be used in a silent scripting environment, because the
    script hangs and waits for the dialog to be answered. Is there a way to still set Cookies to be accepted for all like in 8.1? I tried every setting in Internet Options in Windows 10, but nothing holds the key. I believe they stopped using it
    and perhaps moved that setting elsewhere, but I can't find it. Microsoft Edge doesn't have many settings either, so none of them were helpful.

    This is just infuriating. Any help would be highly appreciated, as this will create quite a chaos in many environments.
     
    Johnathan87, Aug 23, 2018
    #3
  4. Arul_D Win User

    Powershell WebRequest to Microsoft.com shows Operation Timeout

    How to change the Screen Timeout settings

    Hello,

    Welcome to the Microsoft Community.

    I would suggest you to follow the below steps and check if it helps.


    • Right click on the desktop and click on Personalization.

    • Click on Lock screen

    • On the bottom of the screen click on Screen Timeout.

    • Under screen select the Time period accordingly.
    Reply us back with the status of this issue. We will be glad to assist you.
     
    Arul_D, Aug 23, 2018
    #4
Thema:

Powershell WebRequest to Microsoft.com shows Operation Timeout

Loading...
  1. Powershell WebRequest to Microsoft.com shows Operation Timeout - Similar Threads - Powershell WebRequest Microsoft

  2. PowerShell fails to launch excel with CLSID COM error

    in Windows 10 Software and Apps
    PowerShell fails to launch excel with CLSID COM error: Hi Community,Really simple issue here we cannot figure out:1. Since 2015, Microsoft released this functionality and is officially documented here2. When we try to run the command in PowerShell below this is what happens:$excel = New-Object -ComObject...
  3. PowerShell fails to launch excel with CLSID COM error

    in Windows 10 BSOD Crashes and Debugging
    PowerShell fails to launch excel with CLSID COM error: Hi Community,Really simple issue here we cannot figure out:1. Since 2015, Microsoft released this functionality and is officially documented here2. When we try to run the command in PowerShell below this is what happens:$excel = New-Object -ComObject...
  4. This Operation Returned Because Timeout period Expired

    in Microsoft Windows 10 Store
    This Operation Returned Because Timeout period Expired: Hey all, so im having an issue launching Minecraft Dungeons from the microsoft store. It isnt launching and it says this plz help. https://answers.microsoft.com/en-us/windows/forum/all/this-operation-returned-because-timeout-period/948de1d2-2d49-4026-b9c2-c2bc8f31da43
  5. This Operation Returned Because Timeout period Expired

    in Microsoft Windows 10 Store
    This Operation Returned Because Timeout period Expired: All UWP games now return the above error a while after attempting to start. All were working fine a couple of days ago https://answers.microsoft.com/en-us/windows/forum/all/this-operation-returned-because-timeout-period/052408ea-6886-4427-92f4-e47cd61b667b
  6. PowerShell scripts not working with Call operator

    in Windows 10 BSOD Crashes and Debugging
    PowerShell scripts not working with Call operator: Hello I have been developing a Powershell script using Powershell ISE, and for the most part i am very happy about it, however i have encountered what i believe to be a bug in the call operator (&). When i use the call operator followed by a "pure" string everything works...
  7. "The operation returned because timeout expired"

    in Windows 10 Installation and Upgrade
    "The operation returned because timeout expired": [ATTACH] Most programs except snipping tool and chrome don't work. Even the Start Menu and Task Manager don't work. They give the same message every time. The message appears a long time after I click them. I'm on build 1709 trying to upgrade to 1809. Note that this is a...
  8. This Operation Returned Because Timeout period Expired

    in Windows 10 BSOD Crashes and Debugging
    This Operation Returned Because Timeout period Expired: Hello all. I have a problem when opening an application that I installed from Microsoft Store and also when opening the Task Manager and Windows Start. when opening the application there was the words "This Operation Returned Because Timeout period Expired" when I open the...
  9. Windows 10 Powershell Invoke-WebRequest “Windows Security Warning ”

    in Windows 10 Software and Apps
    Windows 10 Powershell Invoke-WebRequest “Windows Security Warning ”: Alright this is one big problem in my opinion that Microsoft needs to address immediately. Steps to reproduce this: powershell> Invoke-WebRequest "anywebsitewithcookies.com" (Let's do microsoft.com for example) What happens is that you get the following warning: [img]...
  10. Please Help To Undo PowerShell Operation.

    in Windows 10 Support
    Please Help To Undo PowerShell Operation.: Hello, So I have 51GB .eappx file that needed to be decrypt-ed. I launched powershell and put in the command line Add-appxpackage "File location here".eappx I had to run powershell as admin to properly execute the operation but I did not. It said Deployment...

Users found this page by searching for:

  1. invoke-webrequest the operation has timed out