ESX4: Turn on/off Virtual Machine using Command Line

Using the vmware-cmd command you can perform a number of actions on your Virtual Machines from the command line.

Below shows you some of the functions you can perform :

List Virtual Machines

[root@ESX4 ~]# vmware-cmd -l
/vmfs/volumes/4c16a0ec-2c7ebe2a-6ad5-0011s8azz71c/OpenSolaris 2009.06/OpenSolaris 2009.06.vmx
/vmfs/volumes/4c16a0ec-2c7ebe2a-6ad5-0011s8azz71c/CentOS 5 – Oracle/CentOS 5 – Oracle.vmx
/vmfs/volumes/4c16a0ec-2c7ebe2a-6ad5-0011s8azz71c/CentOS 5a/CentOS 5a.vmx

Turn On Virtual Machine

Below shows you how to start a virtual machine, to stop it just change the start command for stop.

[root@ESX4 ~]# vmware-cmd “/vmfs/volumes/4c16a0ec-2c7ebe2a-6ad5-0011s8azz71c/OpenSolaris 2009.06/OpenSolaris 2009.06.vmx” start
start() = 1

List Virtual Machine Status`s

There maybe another (and easier) way of listing the virtual machine status`s if so please send it in.

vmware-cmd -l | sed ‘/^$/d’ |  while read VMX ; do STATE=$(vmware-cmd  “${VMX}” getstate | awk ‘ { print $3 } ‘) ;  echo “${VMX}” = “${STATE}” ; done

Rick Donato

Want to become a VMware expert?

Here is our hand-picked selection of the best courses you can find online:
Complete VMware Administration course
VMware vSphere 7 – Install, Configure, Manage
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial