Working from linux I miss the luxury of having vSphere client on hand to power on/off VMs as I need them. There is only one solution – do that via SSH.
Of course for this to work SSH needs to be enabled on the ESXi host – see here.
First list all VMs:
[root@esxi:~] vim-cmd vmsvc/getallvms Vmid Name File Guest OS Version Annotation 13 CentOS2 [SSD] CentOS2/CentOS.vmx centos64Guest vmx-11 Linked-Clone
then verify that the VM is powered down:
[root@esxi:~] vim-cmd vmsvc/power.getstate 13 Retrieved runtime info Powered off
now to power it on and check the status run:
[root@esxi:~] vim-cmd vmsvc/power.on 13 Powering on VM: [root@esxi:~] vim-cmd vmsvc/power.getstate 13 Retrieved runtime info Powered on
Next to find out the IP address of the VM that we have just powered on run:
[root@esxi:~] vim-cmd vmsvc/get.guest 13 | grep ipAddress ipAddress = "10.10.1.109", ipAddress = (string) [ ipAddress = (vim.net.IpConfigInfo.IpAddress) [ ipAddress = "10.10.1.109", ipAddress = "fe80::20c:29ff:fec8:db22", ipAddress = (string) [ ipAddress = "10.10.1.254", ipAddress =, ipAddress = , ipAddress = "fe80::221:55ff:fefb:da4", ipAddress = ,
Now we can RDP or SSH into that box or power it off by running:
[root@esxi:~] vim-cmd vmsvc/power.off 13 Powering off VM: