title: Powershell v3 Invoke-WebRequest HTTPS error
body: <p>Using Powershell v3's Invoke-WebRequest and Invoke-RestMethod I have succesfully used the POST method to post a json file to a https website.</p>
  
  <p>The command I'm using is</p>
  
  <pre><code> $cert=New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("cert.crt")
   Invoke-WebRequest -Uri https://IPADDRESS/resource -Credential $cred -certificate $cert -Body $json -ContentType application/json -Method POST
  </code></pre>
  
  <p>However when I attempt to use the GET method like:</p>
  
  <pre><code> Invoke-WebRequest -Uri https://IPADDRESS/resource -Credential $cred -certificate $cert -Method GET
  </code></pre>
  
  <p>The following error is returned</p>
  
  <pre><code> Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
   At line:8 char:11
   + $output = Invoke-RestMethod -Uri https://IPADDRESS/resource -Credential $cred
   +           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest)      [Invoke-RestMethod], WebException
  + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
  </code></pre>
  
  <p>I have attempted using the following code to ignore SSL cert, but I'm not sure if its actually doing anything.</p>
  
  <pre><code> [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
  </code></pre>
  
  <p>Can someone provide some guideance on what might be going wrong here and how to fix it?</p>
  
  <p>Thanks</p>