List VMs by a Filter


Using the vSphere SDK, I am trying to figure out how to get a list of VMs and filter them by their properties.

For example:
get all of the VMs with a config.hardware.numCPU value of 2
get all of the VMs with a guest.guestFamily value of "linuxGuest"

Thank you.

Sign in to be able to add comments.

Comments 3

ucxmyron 3 years ago
I also wanted to add that I am coding against vSpher version 5.5.0 Build 3717267
vickyvision2020 3 years ago
I will work on this and will post the solution.
ucxmyron 3 years ago
Thank you