6.0.1

Table Of Contents
n
If you plan to script commands and need to know what the exit codes are, see “Exit Codes for the
VMware Tools Configuration Utility,” on page 223.
Procedure
1 Write a new script or modify default scripts and save them as .bat files with new names.
The default scripts for power-on and power-off operations are placeholders only. These scripts are
located in the Program Files\VMware\VMware Tools directory.
The scripts for suspend and resume operations contain a line that releases or renews the IP address for
the virtual machine. You must add this line first when you write custom scripts for these operations.
Default Script Required IP Address Line
suspend @%SYSTEMROOT%\system32\ipconfig /release
resume @%SYSTEMROOT%\system32\ipconfig /renew
2 Open a command prompt in the guest operating system.
3 Change directories to the VMware Tools installation directory.
The default installation directory is C:\Program Files\VMware\VMware Tools.
4 Type the command to enable the script.
VMwareToolboxCmd.exe script script-name enable
5 Type the command to use the custom script that you created.
VMwareToolboxCmd.exe script script-name set script-path
For script-path, use the full path to the file, such as, C:\Temp\poweron-my-vm.bat.
6 Type the command to verify that the custom script that you specified is now being used.
VMwareToolboxCmd.exe script script-name current
The VMware Tools service runs the script whenever the specified power operation occurs.
Use Custom Scripts in Operating Systems Other Than Windows
On Linux, Mac OS X, Solaris, and FreeBSD guest operating systems, you can write scripts to automate guest
operating system operations when you change the power state of a virtual machine.
For Linux, Mac OS X, Solaris, and FreeBSD guests, you can write scripts and place them in a certain
directory, and then VMware Tools runs your scripts in addition to the default scripts. For power-on and
resume operations, the default scripts run before the custom scripts. For suspend and power-off, the default
scripts run after the custom scripts. This way, VMware Tools stops services only after the custom scripts
finish their work and, conversely, restores the same services before the custom scripts attempt to use the
services.
The VMware Tools service, or daemon (vmtoolsd), runs scripts. Because vmtoolsd runs as root on Linux,
Mac, Solaris, and FreeBSD, and as System on Windows, the scripts run in a separate session from the session
of the logged-in user. The VMware Tools daemon does not detect desktop sessions, which means that it
cannot display graphical applications. Do not attempt to use custom scripts to display graphical
applications.
Prerequisites
n
Familiarize yourself with the default VMware Tools scripts. See “Default VMware Tools Scripts,” on
page 220.
n
On Linux, Mac OS X, Solaris, and FreeBSD guest operating systems, to test, edit, or disable the running
of a script, log in as root.
Chapter 11 VMware Tools Components, Configuration Options, and Security Requirements
VMware, Inc. 219