Powershell 连接VIServer不';由于证书无效而无法连接,忽略PowerCLI';s配置

Powershell 连接VIServer不';由于证书无效而无法连接,忽略PowerCLI';s配置,powershell,vmware,vsphere,powercli,Powershell,Vmware,Vsphere,Powercli,正如标题所示,我正在尝试使用PowerCLI登录VMWare vSphere服务器。尽管我运行了Set PowerCLIConfiguration-InvalidCertificateAction Ignore-Confirm:$false-Scope AllUsers,但当我尝试连接到服务器时,我得到的是: Connect-VIServer -Server "foobar.server" -User ... -Password ... Connect-VIServer : 3/30/2020

正如标题所示,我正在尝试使用PowerCLI登录VMWare vSphere服务器。尽管我运行了
Set PowerCLIConfiguration-InvalidCertificateAction Ignore-Confirm:$false-Scope AllUsers
,但当我尝试连接到服务器时,我得到的是:

Connect-VIServer -Server "foobar.server" -User ... -Password ...
Connect-VIServer : 3/30/2020 4:16:46 PM Connect-VIServer                Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt if you'd like to connect once or to add a permanent exception for this server.
Additional Information: Could not establish secure channel for SSL/TLS with authority 'foobar.server'.
At line:1 char:1
+ Connect-VIServer -Server "foobar.server" -User ... -Passw ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Connect-VIServer], ViSecurityNegotiationException
    + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_CertificateError,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
配置似乎需要:

Get-PowerCLIConfiguration

Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayDeprecationWarnings WebOperationTimeout
                                                                                                  Seconds
-----    -----------     ------------------- ------------------------  -------------------------- -------------------
Session  UseSystemProxy  Multiple            Ignore                    True                       300
User                                         Ignore
AllUsers                                     Ignore

为什么我无法连接到服务器?

如果您使用的是较旧版本的vCenter(5.5),请尝试以下操作:

[System.Net.ServicePointManager]::SecurityProtocol =[System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'

更改后是否重新启动了PowerCLI?@AdminOfThings重新启动PowerCLI是什么意思?我计划最终在脚本中使用这个。。。