Created
March 23, 2018 15:34
-
-
Save amandadebler/8e5124c9486b732316679746168c90b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12' | |
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols | |
Add-Type -AssemblyName System.Web | |
Add-Type -AssemblyName system.Security | |
Add-Type -AssemblyName System | |
Add-Type @" | |
using System.Net; | |
using System.Security.Cryptography.X509Certificates; | |
public class TrustAllCertsPolicy : ICertificatePolicy { | |
public bool CheckValidationResult( | |
ServicePoint srvPoint, X509Certificate certificate, | |
WebRequest request, int certificateProblem) { | |
return true; | |
} | |
} | |
"@ | |
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get PowerShell to ignore SSL errors for Invoke-WebRequest and (possibly) Invoke-RestMethod. Useful when testing responses from individual servers behind a load balancer.