简体   繁体   English

VMware powercli 连接到单个 esxi homelab 的错误

[英]VMware powercli connection error to single esxi homelab

Environment环境

Home VMware lab consisting of a single VMware ESXi host.由单个 VMware ESXi 主机组成的家庭 VMware 实验室。

  • Client version: 1.33.4客户端版本:1.33.4
  • Client build number: 14093553客户端内部版本号:14093553
  • ESXi version: 6.7.0 ESXi 版本:6.7.0
  • ESXi build number: 14320388 ESXi 内部版本号:14320388

PC running the script运行脚本的PC

  • Windows 10 Windows 10
  • Powershell 5.1 Powershell 5.1
  • VMware PowerCLI 12.0.0 build 15947286 VMware PowerCLI 12.0.0 内部版本 15947286
  • user connecting has the vmware administrator role attached to it.连接的用户具有附加的 vmware 管理员角色。

Code代码

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

Error错误

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 : {}

What I've tried我试过的

leaving of the credentials and having it ask, gives the same error留下凭据并让它询问,给出相同的错误

Deliberately getting the password wrong - gives an incorrect password message故意弄错密码 - 给出不正确的密码信息

Removing the administrator role from the user - gives a not authorised message从用户中删除管理员角色 - 给出未经授权的消息

The output of the last two tests leads me to believe I am in fact authenticating ok, but that there is then some setting/service I've not set or enabled that allows it to connect after authenticating.最后两个测试的 output 让我相信我实际上可以通过身份验证,但是有一些我没有设置或启用的设置/服务允许它在身份验证后连接。

Any suggestions would be appreciated.任何建议,将不胜感激。

ESXi hosts assigned the free license don't grant access to consume the API services, which is what PowerCLI is doing under the covers.分配了免费许可证的 ESXi 主机不授予使用 API 服务的访问权限,而这正是 PowerCLI 在幕后所做的事情。

The error message is confirming that you do not have the ability to access the API services.该错误消息确认您无法访问 API 服务。

Just to add a secondary answer in case anybody else stumbles upon it.只是为了添加一个次要答案,以防其他人偶然发现它。 I thought at first that it was because I was connecting to my home eval edition.我一开始以为是因为我正在连接到我的家庭评估版。 However, I got the exact same issue when connecting to our corporate environment.但是,在连接到我们的公司环境时,我遇到了完全相同的问题。

It turns out that my account on the machine was locked down to PowerShell constrained language mode.事实证明,我在机器上的帐户被锁定为 PowerShell 受限语言模式。 Running the commands on an account that did not have the mode set allowed them to run ok.在没有设置模式的帐户上运行命令允许它们正常运行。

To add a further answer to this in case it helps anyone, in my case I just needed to run PowerShell as administrator.要对此添加进一步的答案以防它对任何人有帮助,就我而言,我只需要以管理员身份运行 PowerShell。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM