Wget with HTTP works and HTTPS fails RRS feed

  • Question

  • Hi All

    I am trying to invoke a webrequest to download a ZIP file it fails with below error, but HTTP works fine.

    Look forward for help

    PS C:\Users\XXXXXX\Desktop> wget https://s3.amazonaws.com/ec2-downloads-windows/EC2Config/EC2Install.zip -v
    VERBOSE: GET https://s3.amazonaws.com/ec2-downloads-windows/EC2Config/EC2Install.zip with 0-byte payload
    wget : The underlying connection was closed: An unexpected error occurred on a receive.
    At line:1 char:1
    + wget https://s3.amazonaws.com/ec2-downloads-windows/EC2Config/EC2Install.zip -v
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

    • Moved by Bill_Stewart Friday, January 26, 2018 3:15 PM Unanswerable drive-by question
    Wednesday, December 6, 2017 11:10 AM

All replies

  • Works fine for me.  Perhaps you have a proxy server.


    Wednesday, December 6, 2017 11:20 AM
  • proxy is configured, i use the same url in browser and it works.

    I have even configured proxy from PowerShell : netsh.exe winhttp set proxy proxy-server="XXXXXXX"

    Wednesday, December 6, 2017 11:25 AM
  • You need to specify the proxy.  It may not be a proxy that works with the command.  It is also possible that the proxy is not set up for PowerShell.  Mau proxy servers filter by application.

    The end is that the file is downloaded as long as the network cooperates.  Troubleshooting the network is your responsibility.

     invoke-webrequest -Uri $uri -Proxy $proxy -ProxyUseDefaultCredentials


    Wednesday, December 6, 2017 11:31 AM