Addeded an if else check for against $PSVersiontable.PSEdition to check if the current edition of PowerShell is Core or Desktop. PowerShell Core / 6 will add $PSDefaultParameterValues for Invoke-RestMethod and Invoke-WebRequest to always use the "-SkipCertificateCheck" parameter. PowerShell 5.X and earlier will continue to use the ICertificatePolicy method.
Added a check to _SetCertPolicy.ps1 for the PowerShell edition.
Description
_SetCertPolicy.ps1 will check if $PSVersionTable.Edition is 'Core' or 'Desktop'. It will handle certificate validation accordingly. PowerShell Core/6 will use $PSDefaultParameterValue for Invoke-RestMethod and Invoke-WebRequest. PowerShell Desktop/5.x will continue to use the C# code calling ICertificatePolicy.
Related Issue
Related to issue #7
Motivation and Context
This solves the issue where the module was unable to import on PowerShell Core/6 by changing how a private function handles checking certificates.
How Has This Been Tested?
All existing tests were run prior to commit.
Screenshots (if appropriate):
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
Addeded an if else check for against $PSVersiontable.PSEdition to check if the current edition of PowerShell is Core or Desktop. PowerShell Core / 6 will add $PSDefaultParameterValues for Invoke-RestMethod and Invoke-WebRequest to always use the "-SkipCertificateCheck" parameter. PowerShell 5.X and earlier will continue to use the ICertificatePolicy method.
Added a check to _SetCertPolicy.ps1 for the PowerShell edition.
Description
_SetCertPolicy.ps1 will check if $PSVersionTable.Edition is 'Core' or 'Desktop'. It will handle certificate validation accordingly. PowerShell Core/6 will use $PSDefaultParameterValue for
Invoke-RestMethod
andInvoke-WebRequest
. PowerShell Desktop/5.x will continue to use the C# code calling ICertificatePolicy.Related Issue
Related to issue #7
Motivation and Context
This solves the issue where the module was unable to import on PowerShell Core/6 by changing how a private function handles checking certificates.
How Has This Been Tested?
All existing tests were run prior to commit.
Screenshots (if appropriate):
Types of changes
Checklist: