Caution: Articles written for technical not grammatical accuracy, If poor grammar offends you proceed with caution ;-)
In this article I’m gong to walk through automating the installation of the Windows Guest Agent. There are advantages to automating the guest agent installation. One advantage is instead of pre-installing it in your template you can script the install using the “Run Once” capability exposed through the vCenter Customization Specification.
Included in the vCAC installation package is a zip file named DCAC-GuestAgent2010Zip.zip. This has all the exploded files that are used within the Windows Guest Agent Installer. These are the files we will be utilizing to manually install the service.
Preparing the files for Installation
1. First thing we need to do is extract the zip file so we can access the files within it.
2. Inside the zip file there is a file name “VRMAgent.exe.config” we need to edit this file and replace all references to “localhost” with the “IP” address or “hostname” of the “vCAC server“.
3. Next place the files in a folder on an open share where they can be accessed during the sysprep operation.
Customization Specification
4. Next we need to modify the “Customization Specification” in vCenter. Either create a new specification or open an existing one, make sure to set it to auto-login 1 time, then add the following (Replacing with your environment specific information) to the run once section:
xcopy \\192.168.2.251\Scripts\WinGuestAgent\vCAC-Agent c:\vCAC-Agent\ /e
c:\vCAC-Agent\VRMAgent.exe -Install
sc start VRMAgent_GuestAgent
This will copy the agent files to the guest. You can place the files anywhere you like on the guest, I choose the C drive for simplicity. It then installs the agent service and finally starts the service so it can process requests.
In my article “Executing Scripts with the Windows Guest Agent” we installed the agent directly into the template which has it’s downsides. If we want to have a blueprint that doesn’t need the agent then we will need another blueprint with a template that doesn’t have the agent installed forcing us to have two of the same agents.
Using the agent
Installing the agent from within customization spec has it’s advantages. At first thought you only need one template to support deployments with and without the agent. A common misconception is that you will still need two blueprints. Both using the same template but each having a different customization specification defined. This is not the case. You can create a single blueprint and define your standard customization specification. When you want to utilize the guest agent such as when executing a script you can override the default customization spec with the following custom property:
Property = CloneSpec Value = Customization Spec to utilize.
In my article “Executing Scripts with the Windows Guest Agent” I included a screenshot for a build profile with all the properties to execute a test script. Here is another screenshot of the same build profile with the “CloneSpec” property added:
For details on how to execute the scripts with the agent please refer to Executing Scripts with the Windows Guest Agent.
I have followed this process, and it all seems to be working except for the final execution of the provided script. I have even tried to bring the script over to the new machine to account for a failure of connectivity with no luck. The script I am trying to run is
c:GuestAgentAddDomainuser.cmd {VirtualMachine.Admin.Owner}
and the script itself is
net localgroup administrators %1 /add
I have inspected the log, and all I can tell it fails with code 1.
Any ideas of what I need to change to create the owner as a member of a group
Hey Mike,
Did you ever find a solution to this. I have encountered a similar problem. We are provisioning by cloning and need to get the owner on the VM as a local admin. I have been trying to set up the guest agent, but my machines hang at the CustomizingOS step until they time out and never make it to the step where they would execute the scripts, but execute just fine from a template without the guest agent pre-installed.
I didn’t know if you found a solution to your issue, and maybe that can help me with mine.