【发布时间】:2018-02-21 13:56:12
【问题描述】:
当我尝试在 https 上使用 Invoke-WebRequest 时,我遇到了一些奇怪的错误:
“Invoke-WebRequest:底层连接已关闭:无法为 SSL/TLS 安全通道建立信任关系。”
这是我的代码:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls
$url = "https://X.X.X.X:4343/officescan/console/html/cgi/cgiChkMasterPwd.exe"
$r = Invoke-WebRequest $url -SessionVariable office
对我有什么建议吗??非常感谢。
【问题讨论】:
-
基本上,如果您的 SSL 证书无效或自签名,则会出现此错误,但您可以“信任”脚本的所有 SSL 证书,因此不会出现错误。
-
@SagePourpre,谢谢你的建议,它的工作^^
标签: powershell ssl