Specifications

www.vmware.com
76
VMware GSX Server Virtual Machine Guide
Executing Scripts When the Virtual
Machine’s Power State Changes
You can run scripts in the guest operating system when you change the power state
of a virtual machine; that is, when you power on, power off, suspend or resume the
virtual machine.
Scripts can help automate guest operating system operations when you change the
virtual machine’s power state.
You perform these power operations from the toolbar buttons and menus in the
VMware Virtual Machine Console and the VMware Management Interface.
You can configure scripts to run automatically when you use the power buttons on
the toolbar by choosing VM > Settings > Options > Power, then checking the
appropriate options under Run VMware Tools scripts.
Note: The commands on the Power menu take precedence over how the toolbar
power buttons are configured.
Scripts can be executed only when the VMware Tools service is running. The service is
a part of VMware Tools, so VMware Tools must be running in the guest in order for
scripts to run. The service starts by default when you start the guest operating system.
For more information about the VMware Tools service, see About the VMware Tools
Service on page 90.
Default scripts are included in VMware Tools. On a Windows host, the default script
executed when you suspend a virtual machine releases the IP address of the virtual
machine, while the default script executed when you resume a virtual machine
renews the IP address of the virtual machine (this affects only virtual machines
configured to use DHCP). On a Linux host, the default script executed when you
suspend a virtual machine stops networking for the virtual machine, while the default
script executed when you resume a virtual machine starts networking for the virtual
machine.
In addition, you can create your own scripts. The scripts you can run must be batch
files for Windows hosts, but can be any executable format (such as shell or Perl scripts)
for Linux hosts. You should have a thorough familiarity with these types of scripts
before you modify the default scripts or create your own.
If you create your own scripts, you must associate each script with its particular power
operation. For more information, see Choosing Scripts for VMware Tools to Run