Skip to content

Instantly share code, notes, and snippets.

@chenbojian
Last active April 14, 2020 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chenbojian/9b326e02d4768a541e9d to your computer and use it in GitHub Desktop.
Save chenbojian/9b326e02d4768a541e9d to your computer and use it in GitHub Desktop.
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