Subscribe to Windows IT Pro
February 21, 2010 12:00 AM

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

Windows IT Pro
InstantDoc ID #103589
Rating: (0)

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.

Related Content:

ARTICLE TOOLS

Comments

Add A Comment
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

Blog Archive




    Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.