Hi All,
I want to return full tree of the Datacenters through scriptable task.
example:
Datacenter1:
Cluster1:
Host1:
Host2:
VM1:
VM2
When i try to enumerate Datacenter to get Cluster it fails. Can anyone can help on this?
MyScript:
var myDatacenters = VcPlugin.getAllDatacenters();
for each (i=0;i<myDatacenters.length;i++)
{
for each ( myCluster in myDatacenters[i].cluster )
{
System.debug(cluster.name);
for each ( myHostSystem in myCluster.host )
{
System.debug(myHostSystem.name);
for each ( myVMs in myHostSystem.vm )
{
if(myVMs.isTemplate==true)
{
System.debug(myVMs.name);
}
}
}
for each ( myDatastore in myCluster.datastore )
{
System.debug(myDatastore.name);
//mytotalDatastoreCapacity += myVcDatastore.summary.capacity;
//mytotalDatastoreFreeSpace += myVcDatastore.summary.freeSpace;
}
}
}