From time to time a host may be unmanageable from vCenter / web client or you may only have console access. In my case I was bringing up a Dell EMC VxRail. During initial bringup the ESXi hosts do not get a mgmt IP if you do not have DHCP available so management with the web client is not possible. I do have iDRAC access though so can access the console. I needed to see where the VxRail manager VM was running as it comes up during an election process between the hosts. With console access it is still possible to manage VMs using esxcli.
To discover all VMs on a host run the following
- vim-cmd vmsvc/getallvms
Once you have the output you can use the Vmid to manipulate the powerstate of a VM
- vim-cmd vmsvc/power.get 2
In my case the VM i wanted was powered off. You can run the following to power it on
- vim-cmd vmsvc/power.on 2
And there you have it. Simple VM management using vim-cmd. Explore what else you can leverage it for here