I'm trying to write a workflow to identify and consolidate all VMs and I can't get past the identifying part. I really have no experience with javascript so I'm sure I'm making a mistake somewhere, but can't figure it out.
So, my workflow has one attribute named 'vms' (Array/VC:VirtualMachine). I'm populating that with the getAllVMsOfCluster action. After that I have this scriptable task:
for(i in vms){
var vm = vms[i];
var vmRuntimeInfo = new VcVirtualMachineRuntimeInfo();
if (vmRuntimeInfo.consolidationNeeded == true) {
System.log (vm.name + " needs to be consolidated");
}
else {
System.log ("consolidation value is " + vmRuntimeInfo.consolidationNeeded);
}
}
But all of my output on the log is: 'consolidation value is null'. I know for a fact there are VMs in there that need to be consolidated.