Search the VMware Knowledge Base (KB)
View by Article ID

Setting the customization script for virtual machines in VMware vCloud Director (1026614)

  • 17 Ratings

Details

Although there is information in the vCloud Director User's Guide about setting the customization script and that this script is called before and after customization, some additional information needs to be provided.

Solution

In vCloud Director, when setting a customization script in a virtual machine, the script:
  • Is called only on initial customization and force recustomization.
  • Is called with the precustomization command line parameter before out-of-box customization begins.
  • Is called with the postcustomization command line parameter after out-of-box customization finishes.
  • Needs to be a batch file for Windows virtual machines and a shell script for Unix virtual machines.

Here are sample customization scripts for Windows and Unix and Linux virtual machines: 

Windows sample batch file

@echo off
if "%1%" == "precustomization" (
echo Do precustomization tasks
) else if "%1%" == "postcustomization" (
echo Do postcustomization tasks
)
 
A Unix sample 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


Note:
The length of customization script cannot be greater than 1500 characters.

A Linux sample 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


Note: "=" instead of "==" format works in most flavors of Linux. This format has been tested with SLES, RHEL, Ubuntu etc.

Tags

vcloud-director-guest-customization

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 17 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 17 Ratings
Actions
KB: