VMware Cloud Community
DDim
Enthusiast
Enthusiast
Jump to solution

esxi CLI command for graceful shutdown

Hello,

Which command can I use for clean and graceful shutdown all VM and turn off esxi host  in sequence?


D.

1 Solution

Accepted Solutions
linotelera
Hot Shot
Hot Shot
Jump to solution

Hi

this is just an example... sure you could try many improvement following powercli commands guide (see official doc)... sure before use it you should connect using command Connect-VIServer.

You should use this script via powercli (Download link: https://my.vmware.com/web/vmware/info/slug/datacenter_cloud_infrastructure/vmware_vsphere/6_0#driver...‌) then save file with ps1 extension.

There are some commands you could be executed via ssh directly to the single host... I define this way as a big management workaround, because the purpose of the host cli is for emergency or straordinary management. I suggest to try powercli before.

Regards

View solution in original post

3 Replies
linotelera
Hot Shot
Hot Shot
Jump to solution

Hi, I suggest the use of powercli with this sequence:

$host = "192.168.1.10"

$vms = Get-Vm

foreach($vm in $vms){

    Shutdown-VMGuest -VM $vm -Confirm

}

Stop-VMHost $host -Confirm

Regards

DDim
Enthusiast
Enthusiast
Jump to solution

Thank you!

Please tell me, how I can run this script on esxi host via ssh ?

Reply
0 Kudos
linotelera
Hot Shot
Hot Shot
Jump to solution

Hi

this is just an example... sure you could try many improvement following powercli commands guide (see official doc)... sure before use it you should connect using command Connect-VIServer.

You should use this script via powercli (Download link: https://my.vmware.com/web/vmware/info/slug/datacenter_cloud_infrastructure/vmware_vsphere/6_0#driver...‌) then save file with ps1 extension.

There are some commands you could be executed via ssh directly to the single host... I define this way as a big management workaround, because the purpose of the host cli is for emergency or straordinary management. I suggest to try powercli before.

Regards