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
.
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 specifysoftas thepowerop_modevalue, the result of the call depends on the operation.OperationResultStopvmware-cmdattempts to shut down the guest operating system and powers off the virtual machine.Resetvmware-cmdattempts to shut down the guest operating system and reboots the virtual machine.Suspendvmware-cmdattempts to run a script in the guest operating system before suspending the virtual machine.
- Hard power operations -vmware-cmdimmediately and unconditionally shuts down, resets, or suspends the virtual machine.
The following examples
illustrate how to use
vmware-cmd
.
- Start - Use thestartoption to power on a virtual machine or to resume a suspended virtual machine. Thepowerop_mode, eitherhardorsoft, 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 thesoft 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.
- Check that VMware tools is installed so that you can reset the virtual machine with the defaultpowerop_mode, which issoft.
See Retrieving Virtual Machine Attributes.vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx gettoolslastactive - 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.
- Thesuspendoption with thehard powerop_modeunconditionally 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
- Thesuspendoption with thesoft powerop_moderuns scripts that result in a graceful shut-down of the guest operating system and shuts down the virtual machine. VMware Tools must be installed forsoft powerop_mode.vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx suspend soft