VMWare PowerCli-连接远程ESX主机时出现问题-ResourceUnavailable:(:) [Get-VMHost],ViServerConnectionException

时间:2019-01-25 13:26:56

标签: vmware powercli esx

我正在尝试使用PowerCli 6.5版本release1连接远程ESX主机,以从Windows 10系统获取所有VM。 在执行connect-VIServer时,我没有得到任何输出或错误。但是,在执行get-VMHost时,出现以下错误消息。 Vsphere Client可以使用相同的凭据连接到ESX主机。请帮助解决powercli问题。

PS C:\> Connect-VIServer 10.44.6.45
PS C:\> Get-VMHost
Get-VMHost : 1/25/2019 6:51:43 PM       Get-VMHost              You are not currently connected to any servers. Please connect first
using a Connect cmdlet.
At line:1 char:1
+ Get-VMHost
+ ~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-VMHost], ViServerConnectionException
    + FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVMHost

PS C:\>

1 个答案:

答案 0 :(得分:0)

根据您的代码,我不认为您已连接到10.44.6.45主机。我希望看到连接的主机的响应以及用于建立该连接的凭据,而您的代码表明根本没有响应。

您可能想尝试以下操作:

$creds = Get-Credential # Note: This will prompt you to enter your credentials
Connect-VIServer -Server 10.44.6.45 -Credential $creds