6.5

Table Of Contents
4
Check that the virtual machine has a snapshot by using the hassnapshot option.
The call returns 1 if the virtual machine has a snapshot and returns 0 otherwise.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx hassnapshot
hassnapshot () = 1
Reverting and Removing Snapshots
You can use vmware-cmd to revert to the current snapshot or to remove a snapshot.
I You cannot use vmware-cmd to revert to a named snapshot. Use the vSphere Web Client to revert
to a named snapshot.
Run vmware-cmd with the revertsnapshot option to revert to the current snapshot. If no snapshot exists, the
command does nothing and leaves the virtual machine state unchanged.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx revertsnapshot
Run vmware-cmd with the removesnapshots option to remove all snapshots associated with a virtual
machine. If no snapshot exists, the command does nothing.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost
<esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx removesnapshots
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 ag, which can be soft or hard.
I You must have the current version of VMware Tools installed and running in the guest
operating system to use a soft power operation.
n
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 aempts to shut down the guest operating system and powers o the virtual machine.
Reset
vmware-cmd aempts to shut down the guest operating system and reboots the virtual machine.
Suspend
vmware-cmd aempts to run a script in the guest operating system before suspending the virtual
machine.
n
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.
n
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
n
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.
vSphere Command-Line Interface Concepts and Examples
128 VMware, Inc.