I created a DRS cluster for testing and try some basic cmdlets.
I was surprised to see that
get-vmhost ESX |get-vm
sends back the list of all the VM in the cluster and not just the one of the ESX.
I put the ESX in maintenance mode and out of the cluster and tried it again... this time the result was the one I expected.
Is this a normal behaviour ?
Did you open your session (Connect-VIServer) before you created the cluster?
Did you create the cluster from within that session (New-Cluster) or from the VI Client?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That shouldn't happen. Are you using the 1.0 GA build? If you run Get-VIToolkitVersion, does it say build 103777?
The cluster was created with GUI before I opened the session whith connect-viserver.
PS C:\Temp> get-cluster Dell |get-vmhost
Name State Id
+----
--+
esx35-03.selab.fr Connected HostSys...
esx35-01.selab.fr NotResponding HostSys...
esx35-08.selab.fr Connected HostSys...
esx35-04.selab.fr Connected HostSys...
esx35-02.selab.fr NotResponding HostSys...
Then
PS C:\Temp> get-vmhost esx35-04.selab.fr | get-vm| select name,@{name="host";expression={$_.host.name}}
Name host
---- -
ahugla_2003Ent_modele esx35-03.selab.fr
PMICHEL-VMXP esx35-03.selab.fr
PSOLABVC esx35-04.selab.fr
xpshowroom1 esx35-04.selab.fr
ofuchs_vsa1 esx35-04.selab.fr
ofuchs_vsa2 esx35-04.selab.fr
SAN-VISTA-FR esx35-04.selab.fr
xpshowroom1 (1) esx35-03.selab.fr
jamesk-w2k3-test01 esx35-04.selab.fr
sql-01 esx35-04.selab.fr
ofuchs_cmc esx35-04.selab.fr
Weird ??
PS C:\Temp> get-vitoolkitversion
VI Toolkit Version
-
VMware VI Toolkit for Windows 1.0 build 103777
I'm able to partially reproduce the behavior you see.
- a cluster with 2 nodes (ESX 3.5)
- the guests are divided over both nodes
- shutdown 1 node
- run the Get-VMHost against the node that was just shutdown and pipe the output to the Get-VM
- the Get-VM also shows guests from the other node (but not all guests)
So it is not exactly what you see since I have the problem with the inactive node.
But it looks as if there is indeed a problem.
This format of the cmdlets gives the same error.
Get-VM -Location (Get-VMHost <ESX-servername>)
A stop/start of the VI shell didn't solve the problem.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I see the same issue. Is there a work around for this ?
Am using the same syntax as Benjamin.
Instead the output returns every VM in the cluster.
Looks like it is also returning all VMs in resource pools in the cluster. The work around is to use something like:
get-vmhost $name | get-vm | where { $_.Host.Name -eq $name }
For example:
PS C:\> $name 10.20.108.156 PS C:\> get-vmhost $name | get-vm | where { $_.Host.Name -eq $name } Name PowerState Num CPUs Memory (MB) ---- ---------- -------- ----------- VM 3 PoweredOff 1 256