当我尝试在https上使用Invoke-WebRequest时,我遇到了一些奇怪的错误:

"Invoke-WebRequest : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."

这是我的代码:

[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

对我有什么建议吗?非常感谢 .