Contents
Using Scripts
Using Scripts
VMware Tools scripts can help automate guest operating system operations when you change the virtual machine's power state.
On the Scripts tab you can enable, disable and run scripts that are associated with changing a virtual machine's power state.
On a Windows host, provided the virtual machine is configured to use DHCP, the script that executes when you suspend a virtual machine releases the IP address of the virtual machine. The script that executes when you resume a virtual machine renews the IP address of the virtual machine.
On a Linux host, the script that executes when you suspend a virtual machine stops networking for the virtual machine. The script that executes when you resume a virtual machine starts networking for the virtual machine.
To disable a script, deselect the check box for the appropriate script then select the path to the script and delete it.
Note: Default scripts for suspending and resuming are written to work together. If you disable the script of one of these actions, disable the script for the other action as well.
Using Default Scripts
Using Default Scripts
A default script for each power operation is included in VMware Tools. These scripts are located in the guest operating system in /etc/vmware-tools.
When You ...
|
This Default Script Runs
|
Suspend the guest operating system
|
suspend-vm-default
|
Resume the guest operating system
|
resume-vm-default
|
Power off the guest operating system
|
poweroff-vm-default
|
Power on the guest operating system
|
poweron-vm-default
|
Using Your Own Scripts (GSX Server, VMware Server, and ESX Server Only)
Using Your Own Scripts (GSX Server, VMware Server, and ESX Server Only)
If the virtual machine is running under GSX Server, VMware Server, or ESX Server, you can use the default script or you can substitute a script you created for each power state change. In addition, if you are logged in as root, you can test a script or disable the running of a script. Complete the following steps.
1. To edit the appropriate power operation, deselect Use default script to suspend guest operating system, Use default script to resume guest operating system, Use default script to shut down guest operating system or Use default script to power on guest operating system.
2. Do one of the following:
To select a different script, click Browse and select the new script.
To edit a script, click Edit. The script opens in vi. Make your changes there.
Note: To edit scripts from the Scripts tab, xterm and vi must be installed in the guest operating system. The user trying to edit the script must be a root user and must have vi and xterm in his or her PATH. Otherwise, scripts can be edited manually in any text editor.
To test a script, click Run Now.
To disable a script, select the path to the script and delete it.
3. Click Apply to save your settings.