title: Powershell Script to download a file from HTTPS website using
body: <p>I need to download a file daily from a website where date will passed. I tried using following code -</p>
  
  <pre><code>$url = "https://www.theocc.com/webapps/threshold-securities?reportDate=20190730"
  $output = "C:\Users\Himanshu.Vats\Downloads\"
  Invoke-WebRequest -Uri $url -OutFile $output
  </code></pre>
  
  <p>But it is giving error -</p>
  
  <blockquote>
    <p>Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
        At line:3 char:1
        + Invoke-WebRequest -Uri $url -OutFile $output
        + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
            + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand</p>
  </blockquote>