Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Return all of the VMs owned by a particular business group

$
0
0

Just a quick note to help anyone out there that may be looking for a list of VMs owned by a particular business group.  May you find it useful.

 

Inputs:

 

vCACCAFE:VCACHost

BusinessGroupName (note: the BG name has been hardcoded below for testing as seen "MyBusinessGroupName")

   

 

Script:

var service = host.createCatalogClient().getCatalogConsumerResourceService();

 

var businessGroupObject = vCACCAFEEntitiesFinder.findBusinessGroups(host,"MyBusinessGroupName")[0];

var businessGroupID = businessGroupObject.getId();

System.log("BusinessGroup ID: " + businessGroupID);

 

var filter = new Array();

filter[0] = vCACCAFEFilterParam.substringOf("organization/subTenant/id", vCACCAFEFilterParam.string(businessGroupID));

var query = vCACCAFEOdataQuery.query().addFilter(filter);

 

var items = service.getResourcesList(new vCACCAFEPageOdataRequest(query));

 

//Removing all deployments, as I was only interested in the VM name. Can parse as needed from this point.

for each( var item in items){

     if(item.hasChildren == false){

          System.log("name:" + item.name);

     }

}


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>