Hey guys,
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.
With powercli:
$vm = Get-VM DrsRuleVM1*
$myCluster = Get-Cluster -Name "MyCluster1" $affinityRule = Get-DrsRule -Cluster $myCluster -Name "*Rule1*"
Set-DrsRule -Rule $affinityRule -VM $vm -Enabled $true;
Thank you, that works. But is there any way to automate it f.e. every other week?
Yes, you can add it to a scheduled task. Or add it at the end of you VM deployment procedure.
Do you mean scheduled tasks in vCenter or just in task scheduler in win?
Sorry i dont have much experience with powercli scripts
task scheduler in win.
PowerCLI is just a collection of PowerShell modules to manage VMware product.