I wanted to ask if there is a way to automate adding newly created VMs to affinity rule that blocks them from one of the hosts in the cluster?
I have seen a post from 2012 but there was no solution.
Thanks for the replies.
$vm = Get-VM DrsRuleVM1*
$myCluster = Get-Cluster -Name "MyCluster1" $affinityRule = Get-DrsRule -Cluster $myCluster -Name "*Rule1*"
Set-DrsRule -Rule $affinityRule -VM $vm -Enabled $true;