I know how to get the list of hosts in a cluster using PowerCLI connecting to vCenter, but is there a way to get the name or ID of the cluster a host is in from the ESXi (5.5) command line? Thanks.
You can try using the following command :
Get-VMhost |ft name,parent
That should give you the ESX host + parent object which in this case is the cluster.
I'm looking for something that uses the ESXi CLI, not PowerCLI.
Hi,
Right now am not infront of the vmlab or prod environ,
So below PS would be of a help please try out and let me know
Function
Get-ClusterNameFromVMName
{
param
(
[string[]]
$VMName
,
[hashtable]
$VmsToHostHash
,
[hashtable]
$HostToClusterHash
)
return
$HostToClusterHash
[
$vmsToHostHash
[
$VMname
]]
}
Thenget cluster name by typing:
Get-ClusterNameFromVM -VMName ‘SomeVMname’ -VmsToHostHash $VmsToHostHash -HostToClusterHash $HostToClusterHash