VMware Cloud Community
gerf0727
Enthusiast
Enthusiast
Jump to solution

How to shutdown powered on VMs by reading a CSV file or just off the Cluster

Hello,

I have csv file with the following headers: "Name","Cluster","ESX Host","Datastore"

This csv lists all the powered on VMs from a cluster XYZ.

How can i read the CSV file and shudown all the VMs ?

or how can i shutdown the powered on VMs of a XYZ cluster ?

Thanks for your help,

0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

To shut down all the powered on vm's from cluster xyz you can do:

Get-Cluster -Name xyz | Get-VM | Where-Object { $_.PowerState -eq "PoweredOn" } |

Shutdown-VMGuest -Confirm:$false

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
1 Reply
RvdNieuwendijk
Leadership
Leadership
Jump to solution

To shut down all the powered on vm's from cluster xyz you can do:

Get-Cluster -Name xyz | Get-VM | Where-Object { $_.PowerState -eq "PoweredOn" } |

Shutdown-VMGuest -Confirm:$false

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos