Skip to content

Instantly share code, notes, and snippets.

@IAmStoxe
Created July 20, 2021 19:07
Show Gist options
  • Save IAmStoxe/6f4580350f9ba3c8320a22ae1ab7e549 to your computer and use it in GitHub Desktop.
Save IAmStoxe/6f4580350f9ba3c8320a22ae1ab7e549 to your computer and use it in GitHub Desktop.
Ignore Invalid SSL Certificates In PowerShell
<# Ignore SSL Cert Hack #>
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
<# End Hack #>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment