Skip to content

Instantly share code, notes, and snippets.

@sonuame
Created October 7, 2020 18:52
Show Gist options
  • Save sonuame/033135df6efefacc7e98f0c6ce09c1c2 to your computer and use it in GitHub Desktop.
Save sonuame/033135df6efefacc7e98f0c6ce09c1c2 to your computer and use it in GitHub Desktop.
powershell ignore ssl
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
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3, [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment