VMware Cloud Community
GarTomlon
Enthusiast
Enthusiast
Jump to solution

Include all VMs in vSphere Folder in array

I have a Configuration Element that is an Array of VC:VirtualMachine.  I have to go in and insert the value of each VM into this array.  How can I include all vms contained in a specific folder in this array automatically? 

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Take a look at scripting module com.vmware.library.vc.folder. There are two scripting actions that return virtual machines contained in a given folder:

  • getAllVirtualMachinesByFolderIncludingSubFolders - gets all VMs for the specified folder and all its subfolders.
  • getAllVirtualMachinesByFolder - get all VMs in the specific folder.

View solution in original post

1 Reply
iiliev
VMware Employee
VMware Employee
Jump to solution

Take a look at scripting module com.vmware.library.vc.folder. There are two scripting actions that return virtual machines contained in a given folder:

  • getAllVirtualMachinesByFolderIncludingSubFolders - gets all VMs for the specified folder and all its subfolders.
  • getAllVirtualMachinesByFolder - get all VMs in the specific folder.