
Recently, I got to see something I haven’t had to experience in a while. I had a VM that wouldn’t power down in the GUI even after I vMotion it to another host. I had to go back into my old school archive for the procedure of bringing down a VM via CLI from the ESXi host it lives on.
Step 1.
Log into ESXi hosts that VM lives on as root
Step 2.
You need to list out all VMs and get their Vmid number
#vim-cmd vmsvc/getallvms
Step 3.
Grab the VMs Vmid from the far left side of screen
See the current state of the VM
#vim-cmd vmsvc/powergetstate vmid#
Step 4.
Power off the VM or if you are looking to reboot move to step 6.
#vim-cmd vmsvc/power.off vmid#
Step 5.
If you need to power on the VM
#vim-cmd vmsvc/power.on vmid#
Step 6.
If you need to reboot the VM use the following command
#vim-cmd vmsvc/power.reboot vmid#
Summary:
There are still times even in the VMWare 6.7 world where you may need to still use CLI to power on/off or reboot a VM. I hope y’all find this article useful.