Being new to vRO im slowly getting a grasp on understanding the workflows. What escapes me is if I put out something in the XaaS lets say for a snapshot the user can see and do a snapshot for anything VM in vcenter. Is there a way to search for VMs within a folder in vcenter or give a listing of vms with a particular prefix. If there is something out there that would be great but being new I would need the whole workflow unless any of you can give exact instructions.
Thanks in advance
Hi,
Here is some code to print the names of VMs within a given VmFolder (input parameter is variable folder of type VC:VmFolder)
for each (var vm in folder.vm) {
System.log(vm.name);
}
Here is some code to print the names of all VMs whose name starts with a given prefix:
var prefix = 'myvm';
var vms = VcPlugin.getAllVirtualMachines(null, "xpath:name[starts-with(.,'" + prefix +"')]");
for each (var vm in vms) {
System.log(vm.name);
}
Hi,
Here is some code to print the names of VMs within a given VmFolder (input parameter is variable folder of type VC:VmFolder)
for each (var vm in folder.vm) {
System.log(vm.name);
}
Here is some code to print the names of all VMs whose name starts with a given prefix:
var prefix = 'myvm';
var vms = VcPlugin.getAllVirtualMachines(null, "xpath:name[starts-with(.,'" + prefix +"')]");
for each (var vm in vms) {
System.log(vm.name);
}
Ilian
Thank you. Its so simple when someone shows you how. Next is for me to get some training but there doesn't seem to be much out there.
James