Private/Unblock-UnityCerts.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Function Unblock-UnityCerts {

  # Hack for allowing untrusted SSL certs with https connexions
  Add-Type -TypeDefinition @"
    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 -TypeName TrustAllCertsPolicy

}