Powershell 连接vc/esxi 主机报错

通过管理员打开window powershell,安装VMware的powercli 模块

https://www.powershellgallery.com/packages/VMware.PowerCLI/12.0.0.15947286

在powershell 执行以下命令安装vmware  的poercli 模块

Install-Module -Name VMware.PowerCLI

问题1:

安装之后连接主机时报如下错误:

因为证书不受信任,所以建立连接失败

解决办法:

设置证书忽略

PS C:\windows\system32> Set-PowerCLIConfiguration -InvalidCertificateAction ignore

 

问题2:

忽略证书是出错

解决方法:

# PowerShell 解除Restricted属性

 导入模块

Import-Module VMware.VimAutomation.Core

 

 再次忽略证书,将不再报错

Set-PowerCLIConfiguration -Scope User -InvalidCertificateAction warn

 

再次链接vc,正常登录。

 

posted @ 2020-04-24 16:01  彦祚  阅读(909)  评论(0编辑  收藏  举报