Download Print this page

VMware VIEW MANAGER 4.X - EXTENDING VIRTUAL MACHINE DELECTION WITH SCRIPTS Manual

Advertisement

Quick Links

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

Advertisement

loading

Summary of Contents for VMware VIEW MANAGER 4.X - EXTENDING VIRTUAL MACHINE DELECTION WITH SCRIPTS

  • Page 1 Table 1. Environment Variables for Deletion Scripts Environment Variable Description VDM_DeleteVm_VmName Name of the virtual machine being deleted. VDM_DeleteVm_VmDnsName DNS name of the virtual machine being deleted. Distinguished name of the virtual machine being deleted. VDM_DeleteVm_VmDn VDM_DeleteVm_VmPath Path in the VMware vCenter™ server that manages the virtual machine being deleted. VDM_DeleteVm_PoolDn Distinguished name of the pool that contains the virtual machine being deleted. VDM_DeleteVm_VcDn Distinguished name of the vCenter server that manages the virtual machine being deleted. VDM_DeleteVm_VmMac.<N> 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. 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.
  • Page 2 To run more than one deletion script, create a string value entry for each script under the DeleteVm key.  You cannot specify the order in which these scripts run. If the scripts must run in a specified order, invoke  them from a single control script. In the topic area, right‐click on the entry for the new string value, and select Modify. In Value data, enter the command line that invokes the deletion script, and click OK. Specify the full path of the deletion script and any files that it requires. If you want the VMware View Script Host service to time out the deletion script, right click on the Default  key, select Modify, enter the timeout value in milliseconds, and click OK. Exit the Registry Editor, and restart the system. Configure the VMware View Script Host Service You must configure the VMware View Script Host service on each View Connection Server instance where you  want View Manager to run the deletion script. By default, the VMware View Script Host service is disabled.    Running a deletion script under the local system account could compromise the security of the View  AUTION Connection Server host. If you configure an account other than the local system account to run a deletion script,  verify that the account has read permission on the registry key for the script. You should also limit the  administrative rights of a deletion script to those rights that allow it to perform its function. To configure the VMware View Script Host service Start the Windows Services tool by entering services.msc at the command prompt. In the details pane, right‐click on the VMware View Script Host service entry, and select Properties. On the General tab, in Startup type, select Automatic. If you do not want the local system account to run the deletion script, select This account, and enter the  details of the account to run the deletion script. Click OK, and exit the Services tool. VMware, Inc.
  • Page 3 VMware, Inc. 3401 Hillview Ave., Palo Alto, CA 94304 www.vmware.com Copyright © 2010 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents. VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions.