首页 > 解决方案 > VMware powercli 连接到单个 esxi homelab 时出错

问题描述

环境

由单个 VMware ESXi 主机组成的家庭 VMware 实验室。

运行脚本的 PC

代码

clear-host
$vc = 'my-hhost-ip'
$user='myuser'
$pw='mypassword'
Set-PowerCLIConfiguration -InvalidCertificateAction:ignore 
Connect-VIServer -server $vc -Protocol https -user $user -password $pw

错误

Connect-VIServer : Specified method is not supported.
At line:6 char:1
+ Connect-VIServer -server $vc -Protocol https -user $user -password $p ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotImplemented: (:) [Connect-VIServer], PSNotSupportedException
    + FullyQualifiedErrorId : NotSupported,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

PSMessageDetails      : 
Exception             : System.Management.Automation.PSNotSupportedException: Specified method is not supported.
TargetObject          : 
CategoryInfo          : NotImplemented: (:) [Connect-VIServer], PSNotSupportedException
FullyQualifiedErrorId : NotSupported,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 16
PipelineIterationInfo : {}

我试过的

留下凭证并让它询问,给出同样的错误

故意输入错误的密码 - 给出错误的密码信息

从用户中删除管理员角色 - 给出未经授权的消息

最后两个测试的输出让我相信我实际上验证正常,但是有一些我没有设置或启用的设置/服务允许它在验证后连接。

任何建议,将不胜感激。

标签: powershellvmware

解决方案


分配了免费许可证的 ESXi 主机不授予使用 API 服务的访问权限,这是 PowerCLI 在幕后所做的。

错误消息确认您无权访问 API 服务。


推荐阅读