Bye Debian/Ubuntu guest customization, hello PowerCLI and Bash

With the vSphere 5 release VMware decided to drop some operating systems using the guest customization wizard. This was already announced with the 4.1 release notes and has gone active now. I guess VMware had the idea that in time people would replace them with supported guest systems.

Quote from the KB:

Starting with vSphere 5.0, the support for customization of these operating systems is deprecated:

  • Debian (All versions)
  • Ubuntu (All versions)
  • Red Hat Enterprise Linux 2.1 Update 1-7
  • Red Hat Enterprise Linux 3.0 Update 1-9
  • SUSE Linux Enterprise Server 8.0 Service Pack 3
  • SUSE Linux Enterprise Server 9.0 Service Pack 1-4
  • Windows 2000 (All versions)

More information can be found in this KB.

Honestly I think that certain guest systems which have been dropped where needed/outdated… Unfortunately I don’t agree on dropping Debian and Ubuntu. I know quite some people who prefer these above Fedora, SUSE, Red Hat,…

With the change this means that if you deploy a template or clone a VM which is from the Debian/Ubuntu type you won’t be able to change the hostname and IP settings by using the wizard or certain PowerCLI commands (Guest-Customization).

I decided to find a small/dirty solution for this. Keep in mind that this is an example on how you can “re-create” the wizard and if wanted even expand it… The example is done by using a Debian 6 template with 1 NIC but it also works with Ubuntu.

First install a clean Debian/Ubuntu VM with 1 NIC (remember VMware tools).

Once the install is finished, login to the VM and make a Bash script with the following code:



rm -rf /etc/udev/rules.d/70-persistent-net.rules

echo $HOSTNAME > /etc/hostname

echo "# This file describes the network interfaces available on your system" > /etc/network/interfaces
echo "# and how to activate them. For more information, see interfaces(5)." >> /etc/network/interfaces
echo "" >> /etc/network/interfaces
echo "# The loopback network interface" >> /etc/network/interfaces
echo "auto lo" >> /etc/network/interfaces
echo "iface lo inet loopback" >> /etc/network/interfaces
echo ""  >> /etc/network/interfaces
echo "auto eth0" >> /etc/network/interfaces
echo "iface eth0 inet static" >> /etc/network/interfaces
echo "  address $IP" >> /etc/network/interfaces
echo "  netmask $SUBNET" >> /etc/network/interfaces
echo "  gateway $GATEWAY" >> /etc/network/interfaces

rm -rf /root/

Place this under /root, save it as “” and make sure it is executable (chmod +x /root/

You can always place it somewhere else if wanted, just change the path in the last line.

Save it and shutdown your VM. Convert it to a template and the first part is done.

Next we will be creating the PowerCLI script:

# Start configuration
# vCenter details
$vcenter = "localhost"

# Config VM peripherals
$vmname = "vm-guestclone"
$ip = ""
$netmask = ""
$gateway = ""

# VM user - must be root user
$GuestCred = "root"
$GuestPass = "temppass"

# VM Deployment Details
$destination_host = "host01.local.lab"
$template_name = "tpl-debian6-clean"
$datastore_name = "LOCAL01"
# End configuration

# PowerOn function, checks if VM is running and if needed start it
function PowerOn-VM {
    param ([string] $vm)

    if ($vm -eq "" ) {
		Write-Host "No VM defined."

    if ((Get-VM $vm).powerstate -eq "PoweredOn" ) {
        Write-Host "$vm is already powered on."
		return "ok"
	} else {
        Start-VM -VM (Get-VM $vm) -Confirm:$false
        Write-Host "Starting $vm now."
        do {
            $status = (Get-vm $vm | Get-View).Guest.ToolsRunningStatus
			sleep 10
        } until ($status -eq "guestToolsRunning")
        return "ok"

Connect-VIServer -Server $vcenter

New-VM -Name $vmname -Template $template_name -VMHost $destination_host -Datastore $datastore_name

$poweron = PowerOn-VM $vmname

if ($poweron -eq "ok") {
	Write-Host "$vmname started."

$command = "/root/ $vmname $ip $netmask $gateway"
Invoke-VMScript -VM $vmname -ScriptText $command -GuestUser $GuestCred -GuestPassword $GuestPass -ScriptType Bash

Restart-VMGuest -VM $vmname

Disconnect-VIServer -Server $vcenter -Confirm:$false

As seen in the script by using Invoke-VMscript we pass 4 parameters to the Bash script:

  1. Hostname
  2. IP
  3. Subnet
  4. Gateway

The script will clone the template and start the VM. As soon as the VMware tools are running the Bash script is called to configure the hostname and network and finally a reboot happens.

Just change the top parameters and run the script and you’ll have a Debian/Ubuntu template deployed and customized. The result can be seen in the screenshot below.

Debian customization

Keep in mind this is a basic example and nothing VLAN based is added or extra guest scripts. This script can be extended to fill your own needs. I just hope this small solution gets you started.


Niels Engelen
Working as a pre-sales with an interest for anything virtual and cloud. Certified as a VMware Certified Professional 4 and 5. Niels also gained the VMware vExpert award (2012-2016) and is an ex-PernixPro.