private/Functions/Disable-CertificateValidation.ps1

function Disable-CertificateValidation {
   #Allows untrusted certificates when connecting to remote HTTPS endpoints

   if (!("TrustAllCertsPolicy" -as [type])) {
   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
}