Bash Script to Shutdown all your VM’s

From time to time I have reboot my ESX server. Although I have configured auto-start and shutdown options I have found it sometimes takes a long time to shutdown the VM’s. Very often I have found it quicker to manually shutdown the VM’s and then reboot. This script below allows this using vmware-cmd and the trysoft command (which tries are soft power shutdown, followed by a hard shutdown if that is unsuccessful)

#!/bin/bash
for vm in ‘vmware-cmd -l’
do
vmware-cmd “$vm” trysoft
done
reboot

Comments are closed.



Podcast

LinkedIn

If you want to add Mike Laverick on LinkedIn, click on this button:

Mike Laverick

Categories

My Pages

Archives

Other VMware Bloggers