O'Reilly logo

Mastering PowerCLI by Sajal Debnath

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the DRS affinity and anti-affinity rules

In this section, we will discuss the advanced settings of a cluster. We can use the following cmdlets for this section:

  • Get-DrsRule
  • New-DrsRule
  • Remove-DrsRule
  • Set-DrsRule

First, we will create a new anti-affinity rule with the two Test1 and Test2 VMs that we created for this purpose. We want to always keep them separate in such a way that they will not run on a single host at any point of time. For this, we will use the New-DrsRule cmdlet to create a rule. We will use the following command for this:

PS C:\> New-DrsRule –Cluster 'Lab Cluster' –Name `  antiAffinityTest1 -KeepTogether $false –VM Test1, Test2

The result of the preceding command is shown in the following screenshot:

Note the warning about the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required