I'm trying to debug a script that makes an https call using Invoke-WebRequest. Since it won't allow the request due to certificate errors, I need to run the following command to disable SSL validation:
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
However, when I attempt to run this command I get the following error:
Unable to find type [System.Net.ServicePointManager].
At line:1 char:1
+ [System.Net.ServicePointManager]::ServerCertificateValidationCallback ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.ServicePointManager:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
OS: macOS Sierra
To replicate the issue:
Download PowerShell for OS X from https://github.com/PowerShell/PowerShell
Install the .pkg
Type 'powershell' in a terminal
Attempt to run the command above.