how to ignore SSL certificate is signed by an unknown certificate authority problem? how to ignore SSL certificate is signed by an unknown certificate authority problem? powershell powershell

how to ignore SSL certificate is signed by an unknown certificate authority problem?


WSManConnectionInfo object has two properties to skip certificate checks.

connectionInfo.SkipCACheck = true;connectionInfo.SkipCNCheck = true;


I agree with Brent, try putting the ServicePointManager call as the first call you make, before even creating the Uri.

The delegate is also missing some parameters, however. Give this a shot:

ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;


I think Brent is correct re: needs to be in the PowerShell process. You'll need a line like the following in your PS:

[System.Net.ServicePointManager]::ServerCertificateValidationCallback += { $true }

Did the following test against an untrusted SSL site and confirmed it overrides the error:

$url = "https://www.us.army.mil"$wc = new-object system.net.webclient$x = $wc.downloadstring($url) # will fail[System.Net.ServicePointManager]::ServerCertificateValidationCallback += { $true }$x = $wc.downloadstring($url) # should succeed

... That said, it's strange that you say the exception happens upon opening the runspace, if that's the case then maybe not, since you aren't even getting to the point of execution of the PowerShell code.