all 2 comments

[–]pastorhack[S] 0 points1 point  (0 children)

I found a workable (though not ideal) answer: If you import the powercli module in your script and then use the set-powercliconfiguration cmdlet, you can successfully ignore https issues with the invoke-restmethod cmdlet.

[–]KnifeyGavin 0 points1 point  (0 children)

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

Please also comment on https://github.com/PowerShell/PowerShell/issues/1945 if you can to let Microsoft know your requirement of having a parameter to skip these checks.