Starting an ESX VM from command line

Sometimes you need to be able to start a VM (Virtual Machine) from the command line. For example when you are experiencing problems with the Virtual Center VM and you don’t have a client with the right tools available (like while standing behind the console of the ESX(i) server in a datacenter).

You can start a VMfrom the commandline with vim-cmd. In case of ESXi logon to the console and enable the ESXi shell trough the troubleshoot options. ALT+F1 gives you access to the terminal.

First get a list of all registered VM’s with:

vim-cmd vmsvc/getallvms

This wil generate a list of all registered VM’s with their Vmid, the location of the .vmx file., version and annotation.

After that you can start the VM’s you want to start with:

vim-cmd vmsvc/power.on vmid

or

vim-cmd vmsvc/power.on /vmfs/volumes/name_of_datastore/path_to_vmx

Of course all this also works through a ssh session.