Created
April 23, 2018 12:24
-
-
Save khorsmann/7b68f0a7eb81d21e8f406a2d5d80fe83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# /vmfs/volumes/datastore1/shutdown-all-vms.sh | |
shutdownmode=soft # could be soft,hard,force | |
VMLIST=`esxcli vm process list | grep "World ID" | cut -d \: -f2` | |
for config in ${VMLIST} | |
do | |
esxcli vm process kill --type=${shutdownmode} --world-id=${config} | |
done | |
sleep 2 | |
echo "show esxcli vm process list" | |
esxcli vm process list | |
echo "enter maintenanceMode --enable true" | |
esxcli system maintenanceMode set --enable true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment