VMware 571779-B21 User Guide - Page 14

Use Custom VMware Tools Scripts, Option, Action, Windows, Linux Solaris, and FreeBSD, Windows guests

Page 14 highlights

VMware Tools Configuration Utility User's Guide Use Custom VMware Tools Scripts You can use scripts to automate guest operating system operations when you change the power state of a virtual machine. You can also edit default scripts or associate custom scripts with power operations. On most guest operating systems, if VMware Tools is installed, you can configure settings so that one or more scripts run when the power state changes. For example, when you power off a virtual machine, by default the poweroff-vm-default script runs if the virtual machine is set to shut down the guest rather than abruptly power off. Scripts are run by the VMware Tools service, or daemon (vmtoolsd). Because vmtoolsd is run as root on Linux, Solaris, and FreeBSD and as System on Windows, the scripts are run in a separate session from the session of the logged-in user. The VMware Tools daemon has no knowledge of desktop sessions, which means that it cannot display graphical applications. Do not attempt to use custom scripts to display graphical applications. IMPORTANT This utility cannot run scripts on Windows NT, Me, Windows 98, or Windows 95 guest operating systems. Scripts are not available on Mac guests. Prerequisites Perform one or more of the following tasks, as necessary: n To familiarize yourself with the default scripts, see "Default VMware Tools Scripts," on page 15. n On Linux, Solaris, and FreeBSD guests, to test, edit, or disable the running of a script, log in as root. n On Linux, Solaris, and FreeBSD guests, to edit a script, make sure xterm and vi are installed in the guest and are in your PATH, or specify which editor to use by setting the EDITOR environment variable. n If you plan to script the commands used in this procedure and need to know what the exit codes are, see "Exit Codes," on page 19. Procedure 1 Examine the contents of the default scripts to determine whether you want to create a custom script by making changes and saving the edited scripts in a new location. Option Windows Linux Solaris, and FreeBSD Action Edit scripts in Program Files\VMware\VMware Tools. Edit scripts in /etc/vmware-tools. 2 Write new scripts or modify default scripts and save them with new names. Option Windows guests Linux, Solaris, and FreeBSD guests Action If you write a new script, create the script as a batch file. Create the script in any executable format, such as a shell or Perl script. 3 Open a command prompt or terminal in the guest. 4 Change to the VMware Tools installation directory. Option Windows Linux and Solaris FreeBSD Action Change directories to C:\Program Files\VMware\VMware Tools. Change directories to /usr/sbin. Change directories to /usr/local/sbin. 14 VMware, Inc.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

Use Custom VMware Tools Scripts
You can use scripts to automate guest operating system operations when you change the power state of a
virtual machine. You can also edit default scripts or associate custom scripts with power operations.
On most guest operating systems, if VMware Tools is installed, you can configure settings so that one or more
scripts run when the power state changes. For example, when you power off a virtual machine, by default the
poweroff-vm-default
script runs if the virtual machine is set to shut down the guest rather than abruptly power
off.
Scripts are run by the VMware Tools service, or daemon (
vmtoolsd
). Because
vmtoolsd
is run as root on Linux,
Solaris, and FreeBSD and as System on Windows, the scripts are run in a separate session from the session of
the logged-in user. The VMware Tools daemon has no knowledge of desktop sessions, which means that it
cannot display graphical applications. Do not attempt to use custom scripts to display graphical applications.
I
MPORTANT
This utility cannot run scripts on Windows NT, Me, Windows 98, or Windows 95 guest operating
systems. Scripts are not available on Mac guests.
Prerequisites
Perform one or more of the following tasks, as necessary:
n
To familiarize yourself with the default scripts, see
“Default VMware Tools Scripts,”
on page 15.
n
On Linux, Solaris, and FreeBSD guests, to test, edit, or disable the running of a script, log in as root.
n
On Linux, Solaris, and FreeBSD guests, to edit a script, make sure
xterm
and
vi
are installed in the guest
and are in your PATH, or specify which editor to use by setting the EDITOR environment variable.
n
If you plan to script the commands used in this procedure and need to know what the exit codes are, see
“Exit Codes,”
on page 19.
Procedure
1
Examine the contents of the default scripts to determine whether you want to create a custom script by
making changes and saving the edited scripts in a new location.
Option
Action
Windows
Edit scripts in
Program Files\VMware\VMware Tools
.
Linux Solaris, and FreeBSD
Edit scripts in
/etc/vmware-tools
.
2
Write new scripts or modify default scripts and save them with new names.
Option
Action
Windows guests
If you write a new script, create the script as a batch file.
Linux, Solaris, and FreeBSD guests
Create the script in any executable format, such as a shell or Perl script.
3
Open a command prompt or terminal in the guest.
4
Change to the VMware Tools installation directory.
Option
Action
Windows
Change directories to
C:\Program Files\VMware\VMware Tools
.
Linux and Solaris
Change directories to
/usr/sbin
.
FreeBSD
Change directories to
/usr/local/sbin
.
VMware Tools Configuration Utility User's Guide
14
VMware, Inc.