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 Machines
vim-cmd vmsvc/getallvmsGet a Virtual Machines state (on/off etc)
vim-cmd vmsvc/power.getstatePower 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}' `; do vim-cmd vmsvc/power.getstate $x;vim-cmd vmsvc/getallvms| grep -E ^$x ;done
This is my favourite and very useful. Keep these to hand for cut and paste when required.
Power off the ESXi server
poweroff
enjoy
NG
Comments
Post a Comment