Q. How can I start a VMware ESX virtual machine (VM) from the command line?

John Savill

February 20, 2010

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. There may be times when you can't manage ESX through the GUI, but thankfully you can still manage virtualization from the command prompt.

First, you can list all the VMs on a server using the vmware-cmd -l command. For example,

vmware-cmd -l

produces

/vmfs/volumes/f27f61fa-1c0f60ae/Test/Test.vmx/vmfs/volumes/f27f61fa-1c0f60ae/savdalvdi01/savdalvdi01.vmx/vmfs/volumes/f27f61fa-1c0f60ae/savdalesxvc/savdalesxvc.vmx/vmfs/volumes/f27f61fa-1c0f60ae/savdalappv01/savdalappv01.vmx

Note that you're shown the VMX location for each VMs. You need these paths to actually control the VMs.

To check if a VM is running, specify the VMX file and the getstate switch. For example,

vmware-cmd /vmfs/volumes/f27f61fa-1c0f60ae/savdalesxvc/savdalesxvc.vmx getstate

returns

getstate() = off

To start a VM, just use the start switch. For example,

vmware-cmd /vmfs/volumes/f27f61fa-1c0f60ae/savdalesxvc/savdalesxvc.vmx start

returns

start() = 1

The VM will now be running.

Related Reading:



Check out hundreds more useful Q&As like this in John Savill's FAQ for Windows. Also, watch instructional videos made by John at ITTV.net.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like