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):
~ # vim-cmd vmsvc/getallvms | grep -i CENTOS1 1008 CENTOS1 [CX4-01-LUN9] CENTOS1/CENTOS1.vmx centos64Guest
2. Quick sanity check to verify the VM is actually powered off:
~ # vim-cmd vmsvc/get.summary 1008 | egrep '(power|ip)'
powerState = "poweredOff",
ipAddress = ,
3. Power on, wait a few moments, and check status again:
~ # vim-cmd vmsvc/power.on 1008
Powering on VM:
~ # vim-cmd vmsvc/get.summary 1008 | egrep '(power|ip)'
powerState = "poweredOn",
ipAddress = "10.136.234.38",
~ #
4. Connect with ssh (or RDP, if targeting a Windows VM) and get on with things
Enjoy!
Related posts:
-
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 = ,
}, -
Very thanks for it! You are safe my life!

sorry for my english (: -
Im lost vCenter on blade array, and i’l need up it. Very thanks for help!

RSS Feed
Follow

4 comments
Comments feed for this article
Trackback link: http://www.vcritical.com/2011/03/start-and-manage-a-vm-without-using-vsphere-client/trackback/