ESX4 - How do I turn on/off a Virtual Machine from the 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

About the Author


R Donato

Rick Donato is the Founder and Chief Editor of He currently works as an SDN/NFV Solutions Architect and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001