Restart VM Host using command line

Share

One VM Server does not work today and the VMWare vSphere client was not an option form me today.  Several restrictions including bad internet connection using my cellphone.

The solution was using ssh to VMWare host an then using the command line to power off  and then power on the VM.

  1. List the inventory ID of the virtual machine with the command:

    vim-cmd vmsvc/getallvms |grep <vm name>

    Note: The first column of the output shows the vmid.

  2. Check the power state of the virtual machine with the command:

    vim-cmd vmsvc/power.getstate <vmid>

  3. Power-on the virtual machine with the command:

    vim-cmd vmsvc/power.on <vmid>

More information on this TN from VMWare