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.

About this task

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.

Procedure

  1. Click My Cloud.
  2. In the left pane, click VMs.
  3. In the right pane, select a virtual machine, right-click, and select Properties.
  4. On the Guest OS Customization tab, in the Customization Script panel, click Browse.
  5. 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.

  6. Click OK.

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