Basic vmware-cmd VM Management tips

Tags: , , , , ,

Sometimes using a command line is much more faster than using GUI. Personally I found VMware Virtual Center always have bugs. The following article will guide you how to use vmware-cmd VM management tool for some basic VMware administrative tasks.

The figure below illustrates states, transitions, and state changing commands for virtual machines.
VMware

List path and names of registered VM guest vmx files on the present host
For an example:
# vmware-cmd -l
/vmfs/volumes/473ddda7-2a53d446-x25b-001aa0288d45/SLES9/SLES9.vmx
/vmfs/volumes/473ddd52-a6f731ac-3125-001aa0288d45/SLES10/SLES10.vmx
/vmfs/volumes/473dde07-d8a0f854-rqqa-001aa0288d45/WIN2K3-01/WIN2K3-01.vmx
/vmfs/volumes/473dde07-d8a0f854-eqqa-001aa0288d45/WIN2K3-02/WIN2K3-02.vmx
/vmfs/volumes/47f0819a-9f092588-548c-0015174a435a/WIN2K8-01/WIN2K8-01.vmx
/vmfs/volumes/473daqws-2a53d446-625x-001aa0288d45/WINXP-01/WINXP-01.vmx

VMware ESX provide basic power state options include:

Power on — Powers up the virtual machine and boots the guest operating system if the guest operating system is installed. How to power on VM guest using command line:
#/usr/bin/vmware-cmd /vmfs/volumes/473dde07-d8a0f854-rqqa-001aa0288d45/WIN2K3-01/WIN2K3-01.vmx start

Power off — Powers down the virtual machine. The virtual machine does not attempt to gracefully shut down the guest operating system. How to power off VM guest using command line:
#/usr/bin/vmware-cmd /vmfs/volumes/473dde07-d8a0f854-rqqa-001aa0288d45/WIN2K3-01/WIN2K3-01.vmx stop

Suspend — Pauses the virtual machine activity. All transactions are frozen until you issue a Resume command. How to suspend VM guest using command line:
#/usr/bin/vmware-cmd /vmfs/volumes/473ddda7-2a53d446-x25b-001aa0288d45/SLES9/SLES9.vmx suspend

Resume — Allows virtual machine activity to continue, and releases the Suspended state. How to resume VM guest using command line:
#/usr/bin/vmware-cmd /vmfs/volumes/473ddda7-2a53d446-x25b-001aa0288d45/SLES9/SLES9.vmx resume

Reset —Powers down the virtual machine and restarts it. How to reset VM guest using command line:
#/usr/bin/vmware-cmd /vmfs/volumes/473dde07-d8a0f854-rqqa-001aa0288d45/WIN2K3-01/WIN2K3-01.vmx reset

How to check VM guest power state
#/usr/bin/vmware-cmd /vmfs/volumes/473dde07-d8a0f854-rqqa-001aa0288d45/WIN2K3-01/WIN2K3-01.vmx getstate

How to create VM snapshot using command line:
#/usr/bin/vmware-cmd createsnapshot
#/usr/bin/vmware-cmd /vmfs/volumes/473ddda7-2a53d446-x25b-001aa0288d45/SLES9/SLES9.vmx createsnapshot SLES9_1 SLES9_First_Snapshot

Note:
Quiesce will quiesce file system writes
Memory will grab the memory state

How to Revert Snapshot using command line:
#/usr/bin/vmware-cmd /vmfs/volumes/473ddda7-2a53d446-x25b-001aa0288d45/SLES9/SLES9.vmx revertsnapshot

How to Remove Snapshot using command line:
#/usr/bin/vmware-cmd /vmfs/volumes/473ddda7-2a53d446-x25b-001aa0288d45/SLES9/SLES9.vmx removesnapshots

How to query if VM has a snapshot:
#/usr/bin/vmware-cmd /vmfs/volumes/473ddda7-2a53d446-x25b-001aa0288d45/SLES9/SLES9.vmx hassnapshot

How to register VM guest into inventory:
#/usr/bin/vmware-cmd -s register /vmfs/volumes/47f0819a-9f092588-548c-0015174a435a/WIN2K8-01/WIN2K8-01

How to unregister VM guest into inventory:
#/usr/bin/vmware-cmd -s unregister /vmfs/volumes/47f0819a-9f092588-548c-0015174a435a/WIN2K8-01/WIN2K8-01

Possibly Related Posts:


Leave a Reply