Skip to content

Instantly share code, notes, and snippets.

@trisharia
Last active May 12, 2018 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trisharia/735cfd0790dc7bd9acd8ff99a5a8eea9 to your computer and use it in GitHub Desktop.
Save trisharia/735cfd0790dc7bd9acd8ff99a5a8eea9 to your computer and use it in GitHub Desktop.
Get all the managed VMs in a vRA IaaS instance
// VMware vRealize Orchestrator action sample
//
// Get all the managed VMs in a vRA IaaS instance
//
// For vRO/VRA 7.0+
//
// Action Inputs:
// host - vCAC:VCACHost - vRA IaaS Host
//
// Return type: Array/vCAC:VirtualMachine - all managed VMs in a vRA instance
var result = [];
if (host == null) return result;
var properties = new Properties();
properties.put("IsManaged", true);
var entities = vCACEntityManager.readModelEntitiesByCustomFilter(host.id, "ManagementModelEntities.svc", "VirtualMachines", properties, null);
for each( var entity in entities) {
result.push(entity.getInventoryObject());
}
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment