Performing emergency shut down of VM's on ESX

From VI-Toolkit
Jump to: navigation, search

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

Location

http://kb.vmware.com/kb/1007934