power on/off VM guests in ESXi

This is helpful for running scripts, etc. Get a list of VMs so you can find the Vmid.

# vim-cmd vmsvc/getallvms
Vmid     Name                     File                      Guest OS       Version   Annotation
16     guest1      [guest1] guest1/guest1.vmx         debian6_64Guest   vmx-09              
32     guest2      [guest2] guest2/guest2.vmx         debian6_64Guest   vmx-09              
48     guest3      [guest3] guest3/guest3.vmx         debian6_64Guest   vmx-09              
64     guest4      [guest4] guest4/guest4.vmx         debian6_64Guest   vmx-09              
80     guest5      [guest5] guest5/guest5.vmx         debian6_64Guest   vmx-09 

See if the machine is on or off:

# vim-cmd vmsvc/power.getstate 16
Retrieved runtime info
Powered on

Shut it down:

# vim-cmd vmsvc/power.shutdown 16

Then you can turn it back on:

# vim-cmd vmsvc/power.on 16

Leave a Reply

Your email address will not be published. Required fields are marked *