Skip to main content

Posts

Showing posts from November, 2013

VMWARE ESXi 5.0 Command line quickies

Hi,

It has been a long time since my last posts, but recently I have been working on my home ESXi lab so I thought I would share.

I switched over to using Apple Mac just over a year ago, so I don't have a windows machine running by default to run the vSphere client software and generally all I want to do is startup VMs and switch off the ESXi server when I am done. I did some searching and found that I could use vmware vim-cmd if I SSHed into the ESXi server. This need to be enabled at the console, then you can use putty or your tool of choice to connect.

Anyway there are several commands the following to me are most useful.

List all Virtual Machinesvim-cmd vmsvc/getallvms


Get a Virtual Machines state (on/off etc)vim-cmd vmsvc/power.getstate


Power on a virtual machine
vim-cmd vmsvc/power.on


Combining command to a one liner you can find out the power on state of all Virtual Machines
vim-cmd vmsvc/getallvms && for x in `vim-cmd vmsvc/getallvms| grep vmx-0 | awk '{print $1}'…