Hello together,
in our script we can disable or activate drs rules (Keep vm together or seperate them).
$drs_regeln = Get-DrsRule –Cluster $cluster_object
if ($drs_regeln -eq $null)
{
Write-Host "# No DRS"
}
else
{
foreach($drsrules in $drs_regeln)
{
if ($drsrules.enabled -eq $true)
{
Set-DrsRule -Rule $drsrules -Enabled $false
}
}
Write-Host "# DRS off"
}
But how can i get host affinity rules and deactive them? I found nothing in the WWW. Your my last hope
Thanks. Rainer
I'd recommend using Onyx if the built in powercli cmdlets don't get you the information you need.
That'll help you construct something in a script.
To retrieve DRS host affinity rules, you can do
Get-DrsRule -Cluster its -Type VMHostAffinity
To change such a host affinity DRS rule you have to revert to the API.
See for example 5. Re: How to set vm-to-host affinity rule using PowerCLI 5.1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference