VMware Cloud Community
PanjaNL
Contributor
Contributor

Shutdown all VM's except one

Running ESXi v6.5u1.

I would like to shutdown all running VM's except for one.

Running /sbin/shutdown.sh will shutdown all running VM's (auto started vm's with vmware tools installed, that is) but I need one VM to stay alive.

Is there a way to accomplish this?

0 Kudos
7 Replies
daphnissov
Immortal
Immortal

What license do you have?

0 Kudos
admin
Immortal
Immortal

Use this below blog for shutting down multiple VM. Good Information  provided 

Using PowerShell to Gracefully Shut Down Multiple Virtual Machines in VMware | Pipe2Text.com

or

Easy and Effective solution in PowerCLI to Shutdown VMs with one click: 

First LOGON into the vCenter from locally/remotely PowerCLI

Connect-VIServer -server YouvCenterServerName

PASTE,

get-content c:\cli\vm.txt | foreach-object { shutdown-vmguest $_ }

Press ENTER > DONE! 

EXAMPLE:

C: Is your local C:\ Drive

CLI: You need to create a folder in the C: Drive & name it "cli" or anything you want

VM.TXT: then create a txt file & input all the VM names in it. EX:

VM01

VM02

Vm03

Regards,

Randhir

If you found my answers useful please consider marking them as Correct OR Helpful

0 Kudos
PanjaNL
Contributor
Contributor

The PowerShell method looks good but requires a Windows machine to do the shutdown.

I would like to be able to shutdown all VM's except one from the ESXi host through cli or script.

0 Kudos
UmeshAhuja
Commander
Commander

Hi,

Please find the below link having a script where you can mention your specified VM's for shutdown.

Script: Gracefully Shut Down all VMs on a Given Set of Hosts (VMware/XenDesktop) • Helge Klein

Thanks n Regards
Umesh Ahuja

If your query resolved then please consider awarding points by correct or helpful marking.
0 Kudos
admin
Immortal
Immortal

I am going to test Cli command on my lab ESXI host and let you know  output.......

Regards,

Randhir

0 Kudos
PanjaNL
Contributor
Contributor

Thanks! Looking forward to the results.

0 Kudos
admin
Immortal
Immortal

Power Cli command is working fine for me  . I am able to shutdown group of VM machine from host .

Regards,

Randhir

0 Kudos