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.
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
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.