Add/remove vCAC IaaS VMs to/from DNS server use-case:
A use case which is often required and which I finally found the time to wrap together and do it without the need for any Powershell connection.
How? Well I took Christophe Decanini great “Guest Script Manager” package from this Communities post. More specifically the run dnscmd.exe example from this link but then repackaged it so that it now works when called from vCAC external Stubs MachineProvisioned and MachineDisposing. The only object these two workflows take as input parameter is vCAC:Entity, which comes dynamically from IaaS and nothing else. All other required attributes are pre-set in the workflow and so need to be edited and filled with the relevant information when ported from one environment to the next.
The dnscmd command needs to run on a Windows VM which resides in a vCenter Server which is both connected to vCO via the vCenter plugin (so can be pointed at as VC:VirtualMachine) and that has dnscmd.exe installed.
Here is a screenshot of the Attributes one needs to set before running the workflow:
And here they are in the table below:
|vcacHost||vCAC:VCACHost||Insert you vCAC Server here||Your vCAC Server|
|vm||VC:VirtualMachine||Insert Windows VM with dnscmd installed||Windows VM with dnscmd installed|
|vmUsername||String||Insert DNS admin username||DNS admin username|
|vmPassword||SecureString||Insert DNS admin password||DNS admin password|
|dnsServerFqdn||String||Insert your DNS Server FQDN||DNS Server FQDN|
|zoneNameFqdn||String||Insert your domain||Domain Name|
|createPtr||Boolean||Set Yes or No||Optional PTR Yes or No|
Now we need to associate these 2 workflows with a vCAC external Stub. More information about vCAC external stubs and how they can be associated with vCO workflows and triggered at runtime can be found here in Chris Alleaume’s excellent blog: Chris’s Blog
Make sure you associate your “add to DNS…” workflow with MachineProvisioned stub and “Delete record from DNS…” workflow with MachineDisposing stub as described in Chris’s blog.
For your convenience the two vCO workflows mentioned above can be downloaded from here:
Note: if you are facing an issue with UAC on 2012 and getting and error that it is unable to access file c:\Windows\system32\cmdANSI.exe (Workflow: Copy file from vCO to guest / Scriptable task (item1)#11), know that disabling UAC from the control panel might not be enough as you may also need to modify the registry and reboot as described here: http://social.technet.microsoft.com/wiki/contents/articles/13953.windows-server-2012-deactivating-uac.aspx