You can upload a customization script to a virtual machine. The script runs before and after guest customization when you deploy a virtual machine based on a vApp template.
When you add a customization script to a virtual machine, the script is called:
- Only on initial customization and force recustomization.
- With the "precustomization" command line parameter before guest customization begins.
- With the "postcustomization" command line parameter after guest customization finishes.
The customization script cannot exceed 1500 characters.
- Click My Cloud.
- In the left pane, click VMs.
- In the right pane, select a virtual machine, right-click, and select Properties.
- On the Guest OS Customization tab, in the Customization Script panel, click Browse.
- Navigate to your script file and click Open.
The file must be a batch file for Windows virtual machines and a shell script for Unix virtual machines.
- Click OK.
Example: Customization Script Examples
A sample Windows batch file:
@echo off if "%1%" == "precustomization" ( echo Do precustomization tasks ) else if "%1%" == "postcustomization" ( echo Do postcustomization tasks )
A sample Unix shell script:
#!/bin/sh if [ x$1 == x"precustomization" ]; then echo Do Precustomization tasks elif [ x$1 == x"postcustomization" ]; then echo Do Postcustomization tasks fi