Power on/off VMware VM’s via CLI

Posted: September 22, 2015 in VMWARE

Turn on VMware VM (Virtual Machine) via CLI [Command Language Interpreter (CLI)]

I’m on a client site, we had issues with a VMWare host, we turned on the Host and after a couple of minutes it’s up and running, we wait a couple of minutes more and we can’t connect to the Virtual Machines. My first guess all the VM’s are powered off, I try to connect using VMware vSphere Client, but:

  1.  the Host has a different version.
  2. I need to download the correct client.
  3. No Internet on Site

I head to the VMware Host:

  1. Login to the VMWare
  2. Enable ESXi Shell and SSH
VMware-ESXi-55
    3. Connect to VMWare Host using Putty
PuttySSHVMLogin
PuttySSHVM
    4. Get VMID for all VM’s on the host (VIM-CMD VMSVC/GETALLVMS)
VMWare-VMID-ALLVM
    5. Write down VMID
VMWARE-VMID
    6. Get state of the VM using the VMID (VIM-CMD VMSVC/POWER.GETSTATE %vmid%)
VMWARE-GETSTATE
VMWARE-GETSTATE-INFO
    7. Turn on the VM (VIM-CMD VMSVC/POWER.ON %vmid%)
vmware-poweronVM
With the VMID’s you will be able to power on all your VM”s, comes in pretty handy when you run into a similar situation or you just wan to show off.
In case you want to power off you VM’s  run command VIM-CMD VMSVC/POWER.OFF %vmid%
vmware-powerOffVM
ENJOY!!!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s