【发布时间】:2017-05-05 16:49:24
【问题描述】:
我正在尝试调试使用 Invoke-WebRequest 进行 https 调用的脚本。由于证书错误而不允许请求,我需要运行以下命令来禁用 SSL 验证:
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
但是,当我尝试运行此命令时,出现以下错误:
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
操作系统:macOS Sierra
复制问题:
从https://github.com/PowerShell/PowerShell下载适用于 OS X 的 PowerShell
安装 .pkg
在终端中输入“powershell”
尝试运行上述命令。
【问题讨论】:
标签: macos powershell powershell-core