Performing emergency shut down of VM's on ESX

From VI-Toolkit
Jump to navigation Jump to search

Emergency shut down of all VM's on a host

author: VMware


Gives you the possibility to quickly and cleanly shut down all the VMs on your host with only console access.


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;}'