Extending Virtual Machine Deletion
with Scripts
View Manager 4.x
When you delete a virtual machine from the VMware
scripts to remove Active Directory or database entries that reference the deleted machine. This technical note
describes how to configure View Manager to run such deletion scripts automatically when you delete a virtual
machine.
To enable a deletion script, you add an entry for the script to the Windows Registry, configure the account of
the user who has the appropriate privileges to run the script, and enable the VMware View Script Host service.
You must configure all View Connection Server hosts that need to run deletion scripts. There is no mechanism
to propagate registry changes, VMware View Script Host service configuration changes, and deletion scripts
between View Connection Server hosts.
Environment Variables
Deletion scripts cannot run interactively. A deletion script runs in an environment created by View Manager,
and the script must obtain its input data from this environment. Table
you can use. You should ensure that a deletion script validates the existence of any environment variable that
it uses.
Table 1. Environment Variables for Deletion Scripts
Environment Variable
VDM_DeleteVm_VmName
VDM_DeleteVm_VmDnsName
VDM_DeleteVm_VmDn
VDM_DeleteVm_VmPath
VDM_DeleteVm_PoolDn
VDM_DeleteVm_VcDn
VDM_DeleteVm_VmMac.<N>
VDM_DeleteVm_Error
The following Visual Basic code fragment shows how to access the environment variable for the MAC address
of the first network interface of a virtual machine that is being deleted.
Dim shell
set shell = WScript.CreateObject( "WScript.Shell" )
macAddr0 = shell.ExpandEnvironmentStrings("%VDM_DeleteVm_VmMac.0%")
VMware, Inc.
®
Description
Name of the virtual machine being deleted.
DNS name of the virtual machine being deleted.
Distinguished name of the virtual machine being deleted.
Path in the VMware vCenter™ server that manages the virtual machine being deleted.
Distinguished name of the pool that contains the virtual machine being deleted.
Distinguished name of the vCenter server that manages the virtual machine being deleted.
MAC address for the network interface number of the virtual machine being deleted.
String that describes a problem that occurred while deleting the virtual machine.
View™ environment, you might want to run your own
1 shows the environment variables that
Technical Note
1
Need help?
Do you have a question about the VIEW MANAGER 4.X - EXTENDING VIRTUAL MACHINE DELECTION WITH SCRIPTS and is the answer not in the manual?
Questions and answers