powershell - Connect-VIServer 无法连接,因为证书无效,无视 PowerCLI 的配置
问题描述
正如标题所示,我正在尝试使用 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'
推荐阅读
- r - 如何使用 R 计算具有多个蛋白质序列的 FASTA 文件中的氨基酸
- javascript - How to render Context Provider and Router separately using functional components?
- groovy - How to assign groovy function to a variable and call it?
- amazon-s3 - AWS cloudfront add custom header without using Lambda@Edge
- objective-c - MacOS Core Audio CAF 录音产生全零
- blazor - UserClaimsPrincipalFactory 在 Blazor WebAssembly 3.1(客户端)中不起作用?
- python - 匹配最接近的值面板数据 Pandas
- jquery - 如何仅在单击时保存 localStorage
- c++ - Makefile 更改以在不同格式的文件之间进行选择
- linux - bash 脚本使用 csv 创建用户