I’ve been pretty lucky in that since retiring the UPS equipment in the lab, the flow of electricity to the lab has been both clean and consistent. We get some nasty weather and high winds in this area but I’ll bet there hasn’t been an electrical outage in close to 2+ years. Well, early Tuesday morning we had a terrible storm with hail and winds blowing harder than ever. I ended up losing some soffits, window screens, and a two stall garage door. A lot of mature trees were also lost in the surrounding area. I was pretty sure we’d be losing electricity and the lab would go down hard – and it did.
If you’re familiar with my lab, you might know that it’s 100% virtualized. Every infrastructure service, including DHCP, DNS, and Active Directory, resides in a virtual machine. This is great when the environment is stable, but recovering this type of environment from a complete outage can be a little hairy. After bringing the network, storage, and ESXi hosts online, I still have no DHCP on the network from which I’d leverage to open the vSphere Client and connect to an ESXi host. What this means is that I typically will bring up a few infrastructure VMs from the ESXi host TSM (Tech Support Mode) console. No problem, I’ve done this many times in the past using vmware-cmd.
Well, on ESXi 5.0 Update 1, vmware-cmd no longer brings joy. The command has apparently been deprecated and replaced by /usr/bin/vim-cmd.
Before I can start my infrastructure VMs using vim-cmd, I need to find their corresponding Vmid using vim-cmd vmsvc/getallvms (add |more at the end to pause at each page of a long list of registered virtual machines):
Now that I have the Vmid for the infrastructure VM I want to power on, I can power it on using vim-cmd vmsvc/power.on 77. At this point I’ll have DHCP and I can use the vSphere Client on my workstation to power up the remaining virtual machines in order. Or, I can continue using vim-cmd to power on virtual machines.
As you can see from the output below, there is much more that vim-cmd can accomplish within the virtual machine vmsvc context:
Take a quick look at this in your lab. Command line management is popular on the VCAP-DCA exams. Knowing this could prove useful in the exam room or the datacenter the next time you experience an outage.
Nice article Jason.
Only one thing, vim-cmd has been around since ESXi 3.5. In fact if you log in and ESXi 4.x console you wouldn’t vmware-cmd but vim-cmd instead.
Thanks for the tip on the VCAP. Using command line for tasks will make working for the vcap easier