I recently had cause to restart a virtual machine on my ESXi host, but my usual method of firing up my Windows 7 machine and using the graphical manager was unavailable.
Fortunately the relevant instructions were obtainable from the http://vm-help.com/ site …
Firstly log into the ESXi host itself (which you previously have to enable), and run :-
vim-cmd vmsvc/getallvms
To obtain a list of the current virtual machines. Find the one you want to restart and find the ID for it in the first column. Use this in the following commands :-
vim-cmd vmsvc/power.reboot ${vmid}
This requires the vmware tools installed on the virtual machine, and for the tools to be running (i.e. the virtual machine needs to be reasonably healthy). If this is not the case, you will need to do the equivalent of hitting the reset button :-
vim-cmd vmsvc/power.reset ${vmid}
And that’s it! A lot quicker than the GUI way, unless you happen to have that always running.