Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 231085

Re: Looking for a way to create an automated, and large number of DRS rules.

$
0
0

Like this ?

 

$VCenterServer=server

$VMCluster="Production"

 

Connect-ViServer$VCenterServer

# Stick current DRS rules into an array

$DrsRules=Get-DrsRule-Cluster$VMCluster

 

Get-Cluster$VMCluster|Get-VM-Name'*[ab]v'|

Group-Object-Property {$_-match"(?<name>.*)[a|b]v"; $Matches["name"]} |

Where-Object {$_.Count -eq2} |

ForEach-Object {

    if($DrsRules.name -notcontains"$($_.Values[0][1])-AB"){

        New-DrsRule-Cluster$VMCluster-Name"$($_.Values[0][1])-AB"-KeepTogether$false-VM$_.Group

    }

}


Viewing all articles
Browse latest Browse all 231085

Trending Articles