Skip to content

Instantly share code, notes, and snippets.

@motowilliams
Created January 17, 2016 09:18
Show Gist options
  • Save motowilliams/061ca4a6abf857313d6f to your computer and use it in GitHub Desktop.
Save motowilliams/061ca4a6abf857313d6f 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
@motowilliams
Copy link
Author

then use it with

PS> Invoke-RestMethod -Method Get -Uri https://gist.githubusercontent.com/motowilliams/061ca4a6abf857313d6f/raw/9e0bffc29f71902482379d1e97cd14c379d34cab/do-not-use-this.ps1 | powershell -command -

but, yeah, don't do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment