Friday, June 17, 2011

Power Off All VMs in a cluster

#clear screen
cls

#remove any lingering variables
Remove-Variable -Name * -Force -ErrorAction SilentlyContinue

#Connect to the vCenter where 'vCenter1' is the name of your vCenter
Connect-VIServer vCenter1 

#Get all VMs in the a cluster resource Pool
$vms = Get-VM
Foreach ($vm in $vms)

      #Power Down the Test VM Guests 
       $vm | Shutdown-VMGuest -Confirm:$false

Disconnect-VIServer vCenter1 -Confirm:$false

No comments:

Post a Comment