Hello,
What I want to do is find a set a VMs in vCAC and based on the property value I want to perform an action on them so far this is what I have but keep o getting an error. Any help would be great!
if (host == null){
System.log("No host was defined");
}
//get Virutal Machines from host
var virtualMachines = Server.findAllForType("vCAC:VirtualMachine");
for each (var virtualMachine in virtualMachines){
if (virtualMachine.isManaged == true) System.log("Found Virtual Machine" + " " + virtualMachine);
var properties = new Properties();
properties.put("VirtualMachineID", virtualMachine.virtualMachineID);
var virtualMachineEntity = vCACEntityManager.readModelEntity(host.id, "ManagementModelEntities.svc", "VirtualMachines", properties, null);
var virtualMachinePropertiesEntities = virtualMachineEntity.getLink(host, "VirtualMachineProperties");
for each (var virtualMachinePropertiesEntity in virtualMachinePropertiesEntities) {
if (virtualMachinePropertiesEntity.getProperty("PropertyName") == propertyName) {
}
}
}