Hi
I try to make a vm name as a string automated input to VC:Virtualmachine as an object to do showing ip address such as vm.summary.guest.ipAddress.
Is there any method to do automated select vmname?
Thanks
Ethan
Hi,
I'm not sure what you mean by 'automated select vm', but if you want co convert a string name (like "myvm") to an instance of VC:VirtualMachine type, you can use either the workflow 'Get virtual machines by name with PC' (available under Library > vCenter > Property collector), or a code like the following:
var all = Server.findAllForType("VC:VirtualMachine", "myvm");
System.log("Found VMs: " + all.length);
for each (var vm in all) {
System.log(vm.name);
}
A couple of notes:
Hi,
I'm not sure what you mean by 'automated select vm', but if you want co convert a string name (like "myvm") to an instance of VC:VirtualMachine type, you can use either the workflow 'Get virtual machines by name with PC' (available under Library > vCenter > Property collector), or a code like the following:
var all = Server.findAllForType("VC:VirtualMachine", "myvm");
System.log("Found VMs: " + all.length);
for each (var vm in all) {
System.log(vm.name);
}
A couple of notes: