You can start, reboot, stop, and suspend virtual machines by using vmware-cmd.

You must supply a value for the powerop_mode flag, which can be soft or hard.

Important

You must have the current version of VMware Tools installed and running in the guest operating system to use a soft power operation.

Soft power operations - When you specify soft as the powerop_mode value, the result of the call depends on the operation.

Operation

Result

Stop

vmware-cmd attempts to shut down the guest operating system and powers off the virtual machine.

Reset

vmware-cmd attempts to shut down the guest operating system and reboots the virtual machine.

Suspend

vmware-cmd attempts to run a script in the guest operating system before suspending the virtual machine.

Hard power operations - vmware-cmd immediately and unconditionally shuts down, resets, or suspends the virtual machine.

The following examples illustrate how to use vmware-cmd.

Start - Use the start option to power on a virtual machine or to resume a suspended virtual machine. The powerop_mode, either hard or soft, is required.

vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx start soft

Reset - When you reset the virtual machine with the soft powerop_mode, which is the default mode, the guest operating system is shut down before the reset.

If VMware Tools is not currently installed on the virtual machine, you can perform only a hard reset operation.

a

Check that VMware tools is installed so that you can reset the virtual machine with the default powerop_mode, which is soft.

vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx gettoolslastactive

See Retrieving Virtual Machine Attributes.

b

Use the reset option to shut down and restart the virtual machine.

vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx reset soft

Suspend - You have two options for suspending a virtual machine.

The suspend option with the hard powerop_mode unconditionally shuts down a virtual machine.

vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx suspend hard

The suspend option with the soft powerop_mode runs scripts that result in a graceful shut-down of the guest operating system and shuts down the virtual machine. VMware Tools must be installed for soft powerop_mode.

vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx suspend soft