You can install the guest agent on reference machines to further customize a machine after deployment. You can use the reserved guest agent custom properties to perform basic customizations such as adding and formatting disks, or you can create your own custom scripts for the guest agent to run within the guest operating system of a provisioned machine.

After the deployment is completed and the customization specification is run (if you provided one), the guest agent creates an XML file that contains all of the deployed machine's custom properties c:\VRMGuestAgent\site\workitem.xml, completes any tasks assigned to it with the guest agent custom properties, and then deletes itself from the provisioned machine.

You can write your own custom scripts for the guest agent to run on deployed machines, and use custom properties on the machine blueprint to specify the location of those scripts and the order in which to run them. You can also use custom properties on the machine blueprint to pass custom property values to your scripts as parameters.

For example, you could use the guest agent to make the following customizations on deployed machines:

  • Change the IP address

  • Add or format drives

  • Run security scripts

  • Initialize another agent, for example Puppet or Chef

You can also provide an encrypted string as a custom property in a command line argument. This allows you to store encrypted information that the guest agent can decrypt and understand as a valid command line argument.

Your custom scripts do not have to be locally installed on the machine. As long as the provisioned machine has network access to the script location, the guest agent can access and run the scripts. This lowers maintenance costs because you can update your scripts without having to rebuild all of your templates.

You can configure security settings for the virtual machines to be provisioned by specifying information in a reservation, blueprint, or guest agent script. If the machines to be provisioned requires a guest agent, you must add a security rule that contains that requirement to the reservation or the blueprint. For example, if you use a default security policy that denies communication between all machines, and rely on a separate security policy to allow communication between specific machines, the guest agent might be unable to communicate with vRealize Automation during the customization phase. To avoid this problem during machine provisioning, use a default security policy that allows communication during the customization phase.

If you choose to install the guest agent to run custom scripts on provisioned machines, your blueprints must include the appropriate guest agent custom properties. For example, if you install the guest agent on a template for cloning, create a custom script that changes the provisioned machine's IP address, and place the script in a shared location, you need to include a number of custom properties in your blueprint.

Table 1. Custom Properties for Changing IP Address of a Provisioned Machine with a Guest Agent

Custom Property

Description

VirtualMachine.Admin.UseGuestAgent

Set to true to initialize the guest agent when the provisioned machine is started.

VirtualMachine.Customize.WaitComplete

Set to True to prevent the provisioning workflow from sending work items to the guest agent until all customizations are complete.

VirtualMachine.SoftwareN.ScriptPath

Specifies the full path to an application's install script. The path must be a valid absolute path as seen by the guest operating system and must include the name of the script filename.

You can pass custom property values as parameters to the script by inserting {CustomPropertyName} in the path string. For example, if you have a custom property named ActivationKey whose value is 1234, the script path is D:\InstallApp.bat –key {ActivationKey}. The guest agent runs the command D:\InstallApp.bat –key 1234. Your script file can then be programmed to accept and use this value.

Insert {Owner} to pass the machine owner name to the script.

You can also pass custom property values as parameters to the script by inserting {YourCustomProperty} in the path string. For example, entering the value \\vra-scripts.mycompany.com\scripts\changeIP.bat runs the changeIP.bat script from a shared location, but entering the value \\vra-scripts.mycompany.com\scripts\changeIP.bat {VirtualMachine.Network0.Address} runs the changeIP script but also passes the value of the VirtualMachine.Network0.Address property to the script as a parameter.

VirtualMachine.ScriptPath.Decrypt

Allows vRealize Automation to obtain an encrypted string that is passed as a properly formatted VirtualMachine.SoftwareN.ScriptPath custom property statement to the gugent command line.

You can provide an encrypted string, such as your password, as a custom property in a command-line argument. This allows you to store encrypted information that the guest agent can decrypt and understand as a valid command-line argument. For example, the VirtualMachine.Software0.ScriptPath = c:\dosomething.bat password custom property string is not secure as it contains an actual password.

To encrypt the password, you can create a vRealize Automation custom property, for example MyPassword = password, and enable encryption by selecting the available check box. The guest agent decrypts the [MyPassword] entry to the value in the custom property MyPassword and runs the script as c:\dosomething.bat password.

  • Create custom property MyPassword = password where password is the value of your actual password. Enable encryption by selecting the available check box.

  • Set custom property VirtualMachine.ScriptPath.Decrypt as VirtualMachine.ScriptPath.Decrypt = true.

  • Set custom property VirtualMachine.Software0.ScriptPath as VirtualMachine.Software0.ScriptPath = c:\dosomething.bat [MyPassword].

If you set VirtualMachine.ScriptPath.Decrypt to false, or do not create the VirtualMachine.ScriptPath.Decrypt custom property, then the string inside the square brackets ( [ and ]) is not decrypted.

For more information about custom properties you can use with the guest agent, see Custom Properties for vRealize Automation Guest Agent.