WMware ESXI - suspend all guests
I have an VMware ESXI 5 which I used for testing things, but I don't want it to run all the time, and using the vSphere Client to stop all the VM's and then stop the ESXI server is a bit too much effort. So I figured out how to do it from the commandline using 'vim-cmd'. #/bin/sh VMS=`vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $1}'` for VM in $VMS ; do PWR=`vim-cmd vmsvc/power.getstate $VM | grep -v "Retrieved runtime info"` if [ "$PWR" == "Powered on" ] ; then name=`vim-cmd vmsvc/get.config $VM | grep -i "name =" | awk '{print $3}' | head -1 | cut -d """ -f2` echo "Powered on: $name" echo "Suspending: $name" ...