Powering Virtual Machines On and Off
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.
Soft power operations. When you specify soft as the powerop_mode value, the result of the call depends on the operation.
vmware-cmd attempts to shut down the guest operating system and powers off the virtual machine.
vmware-cmd attempts to shut down the guest operating system and reboots the virtual machine.
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 power_op mode (the default), 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
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