Anyone know a command to find affinity rules for each cluster within each datacenter in a vCenter for all VMs? I need to remove all affinity rules in all clusters located in each datacenter within one vcenter. Any ideas?
Previous post was almost there. This should provide what you're looking for:
ForEach ($dc in Get-Datacenter){
$dc|Get-Cluster|Get-DrsRule|Where {$_.type -eq "VMAffinity"}|Sort cluster|Select Name,Cluster,Enabled,@{N='DataCenter';E={$dc}}
}
I think its something like this even though i know this doesn't work....
foreach($dc in Get-Datacenter){
foreach ($cluster in (Get-Cluster -Location $DC)) | Get-DRSRule
Previous post was almost there. This should provide what you're looking for:
ForEach ($dc in Get-Datacenter){
$dc|Get-Cluster|Get-DrsRule|Where {$_.type -eq "VMAffinity"}|Sort cluster|Select Name,Cluster,Enabled,@{N='DataCenter';E={$dc}}
}
Thank you!!!