Performing emergency shut down of VM's on ESX
Emergency shut down of all VM's on a host
author: VMware
Description
Gives you the possibility to quickly and cleanly shut down all the VMs on your host with only console access.
Script:
Run the following with root privileges:
cat /proc/vmware/vm/*/names | awk -F= '{a=substr($4,$1,length($4)-6); b="vmware-cmd "a" getstate"; print b; system(b); c="vmware-cmd "a" stop"; system(c); } END { print "Number of Machines: "NR;}'