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.

When VMware Tools is installed, if you configure a virtual machine’s power controls to use the guest operating system, or soft, power options, one or more default scripts run on the guest whenever you change the power state of the virtual machine. You change the power state by using menu commands or by clicking the Suspend, Resume, Power On, and Power Off buttons.

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 operating system 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 does not detect desktop sessions, which means that it cannot display graphical applications. Do not attempt to use custom scripts to display graphical applications.


You cannot run scripts on Windows NT, Me, Windows 98, and Windows 95 guest operating systems.

Familiarize yourself with the default VMware Tools scripts. See Default VMware Tools Scripts.

On Linux, Solaris, and FreeBSD guest operating systems, to test, edit, or disable the running of a script, log in as root.

On Linux, Solaris, and FreeBSD guest operating systems, to edit a script, make sure xterm and vi are installed in the guest operating system and are in your PATH, or specify which editor to use by setting the EDITOR environment variable.

If you plan to script the commands used in this procedure and need to know what the exit codes are, see Exit Codes.


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.

Operating System



Edit scripts in Program Files\VMware\VMware Tools.

Linux Solaris, and FreeBSD

Edit scripts in /etc/vmware-tools.


Write new scripts or modify default scripts and save them with new names.

Operating System



If you write a new script, create the script as a batch file.

Linux, Solaris, and FreeBSD

Create the script in any executable format, such as a shell or Perl script.


Open a command prompt or terminal in the guest operating system.


Change to the VMware Tools installation directory.

Operating System

Default Path


C:\Program Files\VMware\VMware Tools

Linux and Solaris





Enter the command to enable the script.

utility-name script script-name enable



utility-name (On Windows)

Use VMwareToolboxCmd.exe.

utility-name (On Linux, Solaris, and FreeBSD)

Use vmware-toolbox-cmd.


Use power, resume, suspend, or shutdown.


Enter the command to use the custom script you created.

utility-name script script-name set script-path

For script-path, use the full path to the file, such as, "C:\Temp\poweron-my-vm.bat".


Enter the command to verify that the custom script you specified is now being used.

utility-name script script-name current

After you complete this procedure, the VMware Tools service runs the script whenever the specified power operation occurs.