Samstag, 15. Juni 2013

vCenter Orchestrator Code Snippet: Find Template Virtual Machines

Hey there,
today I want to show you a very usefull snippet if you plan to automate your deployment processes.
Just create an action to run this script as often as you want to, or include it in your workflows as a scriptable task:

here the the script:
var VMs = VcPlugin.getAllVirtualMachines();
for(i in VMs){
try{
if(VMs[i].config.template == true){
System.log(VMs[i].name);
   }
}
catch(e)
{
System.error(e);
}
}
I think it is not necessary to explain the code.
Extend the script by using an array for all found templates, or what ever you want to do with it.

That's it

Keine Kommentare:

Kommentar veröffentlichen