Find and Start/Stop VM on ESXI

How to find and Start/Stop VM on ESXI.
SSH to the ESXI server.

# esxcli vm process list
# esxcli vm process list
WebHost
   World ID: 35689
   Process ID: 0
   VMX Cartel ID: 35686
   UUID: 56 4d 72 7c da 4c 82 f1-9f 10 9c e3 d6 7d a4 9d
   Display Name: WebHost
   Config File: /vmfs/volumes/54c1dfef-00e03f4b-784e-6805ca0a3085/WebHost/WebHost.vmx

Windows
   World ID: 4150543
   Process ID: 0
   VMX Cartel ID: 4150542
   UUID: 56 4d 49 5f 12 7e 26 96-d8 31 37 05 21 64 5d 46
   Display Name: Windows
   Config File: /vmfs/volumes/54c1dfef-00e03f4b-784e-6805ca0a3085/Windows/Windows.vmx

Monitor
   World ID: 2487010
   Process ID: 0
   VMX Cartel ID: 2487009
   UUID: 56 4d 99 de b0 13 a1 76-bd 2d 95 8a be 25 35 39
   Display Name: Monitor
   Config File: /vmfs/volumes/54c1dfef-00e03f4b-784e-6805ca0a3085/Monitor/Monitor.vmx

Mail
   World ID: 2487029
   Process ID: 0
   VMX Cartel ID: 2487028
   UUID: 56 4d 4f 88 c8 bf a6 37-b5 5b 96 6f b4 23 c5 fb
   Display Name: Mail
   Config File: /vmfs/volumes/54c1dfef-00e03f4b-784e-6805ca0a3085/Mail/Mail.vmx

Stop a VM:

# esxcli vm process kill -t soft --world-id 4150543

Review to verify the VM is off:

 # esxcli vm process list
WebHost
   World ID: 35689
   Process ID: 0
   VMX Cartel ID: 35686
   UUID: 56 4d 72 7c da 4c 82 f1-9f 10 9c e3 d6 7d a4 9d
   Display Name: WebHost
   Config File: /vmfs/volumes/54c1dfef-00e03f4b-784e-6805ca0a3085/WebHost/WebHost.vmx

Monitor
   World ID: 2487010
   Process ID: 0
   VMX Cartel ID: 2487009
   UUID: 56 4d 99 de b0 13 a1 76-bd 2d 95 8a be 25 35 39
   Display Name: Monitor
   Config File: /vmfs/volumes/54c1dfef-00e03f4b-784e-6805ca0a3085/Monitor/Monitor.vmx

Mail
   World ID: 2487029
   Process ID: 0
   VMX Cartel ID: 2487028
   UUID: 56 4d 4f 88 c8 bf a6 37-b5 5b 96 6f b4 23 c5 fb
   Display Name: Mail
   Config File: /vmfs/volumes/54c1dfef-00e03f4b-784e-6805ca0a3085/Mail/Mail.vmx

How to start a Guest VM from Command line:

Get a list of VMs on a host using the command:


# vim-cmd vmsvc/getallvms 
Vmid    Name                   File                       Guest OS          Version   Annotation
32     Monitor   [datastore1] Monitor/Monitor.vmx   centos64Guest           vmx-08
44     Mail      [datastore1] Mail/Mail.vmx         ubuntu64Guest           vmx-08
58     WebHost   [datastore1] WebHost/WebHost.vmx   centos64Guest           vmx-08
61     Plesk     [datastore1] Plesk/Plesk.vmx       centos64Guest           vmx-08
62     Windows   [datastore1] Windows/Windows.vmx   windows8Server64Guest   vmx-08

NOTE: The important fields will be the the VMID of your desired VM

Double check the power state of the VM:


vim-cmd vmsvc/power.getstate <vmid>

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

Start


vim-cmd vmsvc/power.on <vmid>
# vim-cmd vmsvc/power.on 62
Powering on VM: