VMware {code} Community
mediumrare
Enthusiast
Enthusiast

how to get a list of all VMs running on a host

Hi all,

I'd like to know how to get a list of all VMs running on a specific host, for example:

vcenter01 -> datacenter2 -> cluster4 -> host1 -> vm1, vm2, ... vm25

I had a look at the example code in the docs, but it's quite confusing... or I am just not using the correct parameters :smileyconfused:

Can you help me out with some sample code?

Thanks a lot in advance

0 Kudos
2 Replies
EdWilts
Expert
Expert

I can't speak for Java, but for Powershell it's as simple as:

get-vmhost <hostname>  |  get-vm

.../Ed (VCP4, VCP5)
0 Kudos
jusemancio
Contributor
Contributor

0 Kudos