TIL – Some ESXi CLI-Fu (Start/Stop/List VMs)

Following up on some of my other TIL posts and a really really bad “vMotion on a stick” experiment, I had to get down and dirty with the ESXi CLI. Without further adieu heres how to List, Start, and Stop VMs from the ESXi CLI (aka TSM):


You’ll need to have TSM (ssh) enabled on your ESXi host for this to work.

List ESXi VMs

~ # vim-cmd vmsvc/getallvms
Vmid            Name                                          File                                      Guest OS          Version   Annotation
1      dc01.provmware.com        [ix4-200-iscsi] dc01.provmware.com/dc01.provmware.com.vmx        windows7Server64Guest   vmx-07             
2      vCenter01.provmware.com   [ix4-200-iscsi] vCenter01.provmware.com/vcdb.provmware.com.vmx   windows7Server64Guest   vmx-07             
3      vcdb.provmware.com        [ix4-200-iscsi] vcdb.provmware.com/vcdb.provmware.com.vmx        windows7Server64Guest   vmx-07

Stop VMs

~ # vim-cmd vmsvc/power.off 3
Powering off VM:

~ # vim-cmd vmsvc/power.getstate 3
Retrieved runtime info
Powered off

Start VMs

~ # vim-cmd vmsvc/power.on 3
Powering on VM: