HewlettPackard / GlobalDashboardPS

A Powershell module for working with HPE OneView Global Dashboard
MIT License
9 stars 5 forks source link

Ignore SSL certs on PowerShell core #11

Open VincentBerger opened 5 years ago

VincentBerger commented 5 years ago

The method you used to ignore SSL certs does not work on non-Windows platforms with PowerShell core, MacOS in my case, due to missing .Net dependencies. This is the error I'm getting on Mac:

add-type : (3,40): error CS0246: The type or namespace name 'ICertificatePolicy' could not be found (are you missing a using directive or an assembly reference?)
    public class TrustAllCertsPolicy : ICertificatePolicy {
                                       ^

If I remove all the code in Set-InsecureSSL, and use the -SkipCertificateCheck switch on the Invoke-RestMethod call in Invoke-OVGDRequest, then it works See also https://github.com/PowerShell/PowerShell/issues/1945

rumart commented 5 years ago

That switch was introduced in Powershell 6. I need to support 5 (and desktop) so need to find a way to get around it