OK here is one I had some major issues with. I have to very kindly thank Gary over at http://extendingclouds.com for the help he gave me via a webex after dropping him a line on his blog (that was above and beyond). I also have to tip my hat to Sam at http://www.definit.co.uk/ who was a massive help when working with me, and pointed me in the direction I needed to go…because to be honest I didn’t have a clue!!!
This guide assumes you have already ran the “Configure an Active Directory Server” in vCO and that you are able to browse your domain when you go to the Administer view, and select Active Directory.
So firstly you are going to want to create a Workflow Template, use this step by step here from Gary http://extendingclouds.com/2014/03/08/utilizing-the-vcac-workflow-template/
You can test the Workflow Template is working by assigning the ID of the workflow to a Blueprint in Properties à Custom Properties
This workflow is going to run when we build a machine so this is why we add the workflow to ExternalWFStubs.BuildingMachine
When you provision a machine now from this blueprint if you go into vCO you should see that the workflow has run:
If you then check the logs of the successfully ran workflow, you can see all of the properties that vCO has listed for the VM:
OK so that proves the Workflow Template is running and that you can pull out information required.
What I then did was Duplicate that workflow, and start to edit it so that I could pre-stage the VM to be a member of a specific OU:
Please note there may well be a much more efficient way to achieve this and I would be very happy to hear from someone with an idea, however my coding skills are pretty much non-existent, so this is how I go it to work.
On the newly create (duplicated) workflow click edit:
Give it a name. Then add 3 attributes:
Name Type Value
customOU AD:OrganisationalUnit Browse to the OU where you want the VM (please note this is why you must have previously added an AD Server)
machineName string
domainName string DC=ccrashers,DC=local
Then go to Schema and create a new Scriptable Task:
Assign Local Parameters
IN
Local Paramter: vCACVm
Source Parameter: vCACVm [in-parameter]
Type: vCAC:VirtualMachine
Description: vCAC Virtual Machine
OUT
Local Paramter: machineName
Source Parameter: machineName [attribute]
Type: string
Visual Binding
In Parameters In Out Out Attribute
vCACVm vCAC:VirtualMachine vCACVm machineName machineName
Scripting
machineName = vCACVm.virtualMachineName;
Now the scriptable task is complete I then call the built in workflow under all workflow:
IN
Local Parameter Source Parameter Type
ou customOU [attribute] AD:OrganizationalUnit
computerName machineName [attribute] string
domainName domainName [attribute] string
OUT
Local Parameter Source Parameter Type
newCOmputer newComputer.newComputer[out-parameter] AD:ComputerAD
Visual Binding
In Attributes In Out Out Parameters
customOU AD:OrganizationalUnit ou newCOmputer AD:ComputerAD newComputer.newComputer
machineName string computerName
domainName string domainName
Now when I assign this workflow to a blueprint, the new VM is provisioning and a computer account is create in an OU call vCAC Servers on my domain.
Please if anyone knows a better way to do this or has any questions drop me a line, I got through this with lots of help from others so if I can help someone else then all the better.
Good bye for now.
Dean
by