Mike's Realm chown -R us ./base

7Oct/110

vCenter Orchestrator Script – Increment VM Name by 1

Simple little code snippet that you might find handy to use in vCenter Orchestrator.  I am working on a workflow that needs to clone a VM and the name should increment by 1 for example, we want to clone appweb1 (but we already have appweb2, 3, 4) so we want the new VM to be appweb5.

Inside a new Scriptable task create an output parameter called newvmname and make it's source itself.  Then use this bit 'o code:

var vms = System.getModule("com.vmware.library.vc.vm").getAllVMsMatchingRegexp("appweb[0-9]");
 for (var i=0; i System.debug("Counting VMs:" + i);
 }
 var newvmname = "appweb" + i;
If anyone has a better way to do this I'd love to hear it, I know you should be able to use the getAllVMsMatchingRegexp as an action inside the Schema but it seemed clunky to do that then pass to a Scriptable task when you can do it all in one object.
DeliciousDiggTwitterShare

Related posts:

  1. vCenter Orchestrator Setup
  2. vCenter Orchestrator Trouble: SQL Server Connection refused: connect
  3. vCenter Orchestrator Trouble: SSL exception, ‘SSL certificate is missing for this host’
  4. vCenter Orchestrator Import Signed Certificate
  5. Orchestrator Workflow: Change vCPU Count
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.