ESX 5: How to Power On A Virtual Machine from the Command Line

Avengers_lego___captain_america_by_robking21-d4wjhwtSo lately I have been noticing some strange issues with my home lab. Every so often I find my all my virtuall machines are down, however the ESX box is up and running fine. Checking the logs on the ESX server has not helped me get to the bottom of the issue, rather I can just see the messages that the server has rebooted. So at the very least I know that something is happening to the ESX server causing it to crash.

This morning I happned to get lucky as I was sitting in my office when the basement airconditioner turned on around the same time that the whole home dehumidifier kicked on. Bleep when all my UPSs, and then I heard my ESX server power off and power back on again.

So now I am on a mission to figure out how to get my ESX server and my UPS to communicate so i can get at least 30 seconds of power during brownout. However this is an issue for another day, right now I just need to get my Vcenter Server back up and running, however my challenge is how to do so despite the fact that I do not have a Windows machine that I can use to connect directly to my ESX server via Vcenter Client.

Thanfully I can power up my Virtual Machines on the Command Line Via SSH. First step is to log into the ESX Server and get a list of all the Virtual Machines that are currently registerd on it. You can do this using the command below.

 

 # vim-cmd vmsvc-getallvms

Now that I have a list of all my registered Virtual Machines, I need to check its current power state and ensure that it is in fact powered off.

~ # vim-cmd vmsvc/power.getstate 1
Retrieved runtime info
Powered off

Yup – its down. Now lets power it back on.

~ # vim-cmd vmsvc/power.on 1
Powering on VM:
~ #

Now wait a minute or so to allow the Virtual Machine time to boot… Now I should be able to RDP from my Linux Workstation to the Vcenter Server. No extra Windows Workstations needed.

Related articles

Vmware VCenter Virtual Appliance – Death to Windows.. I think.
HomeLab: Simple DHCP Service Configuration on a Cisco Router
NEW VMSA-2013-0016 VMware ESXi and ESX unauthorized file access through vCenter Server and ESX
Anonymous leaks VMware ESX Server Kernel source code