How can I shutdown a virtual machine when I am on the commandline of an ESXi5 host over ssh?
Sidenote:
To enable scripts on other machines to login to the ESXi without password, add the public key of the user on the other machine to the ESXi's "/etc/ssh/keys-root/authorized_keys" if you want to login as root. If you want to login as user x add the key to "/etc/ssh/keys-x/authorized_keys".
From the section 'Using the ESXi 5.0 esxcli command to power off a virtual machine' in KB1014165 at the VMWare Knowledge base:
I hope this helps :)
You can use vim-cmd:
Here is an example (shutdown only one VM: SRV1):
You can also shutdown all host VMs:
Extracted from: http://www.sysadmit.com/2016/07/vmware-esxi-apagar-todas-las-vms-desde-SSH.html