VMware Cloud Community
jyammine
Contributor
Contributor

Shutdown all virtual machines once

Hi,

If we have an ESX server running 4 Virtual Machines (VM), is there exist any command that can be run on the ESX to shutdown the 4 VMs.

Thanks in advance.

Johnny Yammine

Reply
0 Kudos
4 Replies
jitendrakmr
Hot Shot
Hot Shot

There is no single command through which you can shoutdown all the running VMs in single shot; however a script can be written using which you can shutdown all the VMs running on an ESX host. I have attached such script which I found in a forum on this site. Use it at your own risk.

However if there are just 4 Vms then I would prefer manually shutting down them.

Jitendra Kumar

MCSE 2003, VCP, CCNA, ITIL Foundation

VCP, MCSE 2003, MCITP Enterprise Admin, CCNA, ITIL Foundation, Netapp NS0-153 (Storage Networking) Personal Website - http://www.virtualizationtrainings.com, http://www.hillsindia.com
Reply
0 Kudos
LucD
Leadership
Leadership

It's not on the ESX server itself but when you install the VI Toolkit on a Windows client the following will shutdown all your guests.

Get-VM | Shutdown-VmGuest

You first have to connect to a VC server or a specific ESX server

Get-VIServer -Server <VC- or ESX-server>


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
jitendrakmr
Hot Shot
Hot Shot

With Virtual Center Server 2.5 you can select multiple VMs and then on right clicking you can select "power off"/"shutdown guest" to power off/shutdown all selected guests at the same time.

Jitendra Kumar

MCSE 2003, VCP, CCNA, ITIL Foundation

VCP, MCSE 2003, MCITP Enterprise Admin, CCNA, ITIL Foundation, Netapp NS0-153 (Storage Networking) Personal Website - http://www.virtualizationtrainings.com, http://www.hillsindia.com
Reply
0 Kudos
adolopo
Enthusiast
Enthusiast

You can cook up something real fast with "vmware-cmd" (& "stop trysoft") in the *.vmx directory.

#!/bin/bash

vmware-cmd /vmfs/volumes/datastore/VM1_dir/VM1.vmx stop trysoft

vmware-cmd /vmfs/volumes/datastore/VM2_dir/VM2.vmx stop trysoft

chmod 700 the script, and if you don't want to use ROOT, just tweak a user account via sudoers.

Quick, dirty and ugly? Yes. But it works.

Reply
0 Kudos