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

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.

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering System Center 2012

During over 6 hours of training you can join John Savill from your computer as he will walk you through the key components and capabilities of System Center 2012, what’s involved in using the components, and the benefit they can bring to your environment.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.