Advertisement
Guest User

Untitled

a guest
Oct 12th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. $noshutdown = @("DC","vCenter","backup")
  2.  
  3. $vms = (Get-Cluster -Name $clusterName | Get-VM | where {$_.Powerstate -eq "PoweredOn"})
  4.  
  5. foreach ($vm in $vms)
  6. {
  7. if ($noshutdown -contains $vm.Name)
  8. {
  9. continue
  10. }
  11. else
  12. {
  13. $vm | Shutdown-VMGuest -Confirm:$false
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement