Start and Manage a VM Without Using vSphere Client

You’re familiar with features in VMware vSphere that can help bring up critical virtual infrastructure after a widespread datacenter outage — planned or otherwise — but did you also know that it’s possible to power on a virtual machine and even determine the dynamic IP address of a guest OS using a simple command-line utility?  This could be handy after a disaster or if you normally rely on a Windows virtual machine to run the vSphere Client and don’t feel like firing up Fusion for one quick task.

Power on and SSH to a Linux VM from Mac OS X

Consider this real-world situation:  You are working remotely on your Mac and need to log into a powered-off Linux VM back in the datacenter.  Don’t fret — if you can ssh to the host using Tech Support Mode (VMware ESXi 4.1 shown here), you are most of the way there.  Thanks to vim-cmd you can find your VM, power it on, and learn the guest OS IP address in no time:

Let’s break it down step by step:

1. Use grep to find the ID of your VM (1008 in this example):

2. Quick sanity check to verify the VM is actually powered off:

3. Power on, wait a few moments, and check status again:

4.  Connect with ssh (or RDP, if targeting a Windows VM) and get on with things

Enjoy!

Tags: , ,

5 comments

  1. dave’s avatar

    Thanks for the steps.

    It looks like you have to have VMWare guest tools installed in order to get the ip address this way. Is this true?

    ~ # vim-cmd vmsvc/get.summary 16 | egrep ‘(power|ip)’
    powerState = “poweredOn”,
    ipAddress = ,

    We don’t install the guest tools:

    guest = (vim.vm.Summary.GuestSummary) {
    dynamicType = ,
    guestId = ,
    guestFullName = ,
    toolsStatus = “toolsNotInstalled”,
    toolsVersionStatus = “guestToolsNotInstalled”,
    toolsRunningStatus = “guestToolsNotRunning”,
    hostName = ,
    ipAddress = ,
    },

    1. Eric Gray’s avatar

      Yes. You are running Tools aren’t you?

    2. Yura’s avatar

      Very thanks for it! You are safe my life! 🙂
      sorry for my english (:

    3. Yura’s avatar

      Im lost vCenter on blade array, and i’l need up it. Very thanks for help!

    4. Jack’s avatar

      Hi,

      I don’t find IP address in VM summay tab, when i grep the VM summary for IP details using vim-cmd vmsvc, i get the output of ipAddress=

      Sample output:

      ~ # vim-cmd vmsvc/get.summary 9408 | egrep ‘(power|ip)’
      powerState = “poweredOn”,
      ipAddress = ,
      ~ #
      please advise on this, how to edit the VM details by using vim-cmd to set the ipAddress.

Comments are now closed.