So I worte a script and I am at a little roadblock. I can set the DRS and I can write-output the rule value I need to verify against however, I can not think of the way needed, to put into the IF statement, so if DRS is already True it will not run the DRSEnabled switch. Any help would be greatly appreciated.
$clusters = get-cluster | where {$_.Name -notmatch 'test01*'}
$rule = $Clusters | select DRSEnabled
write-output $rule
foreach ($cluster in $clusters)
{
if( )
{
Set-Cluster -Cluster $cluster -DRSEnabled:$True -DRSAutomationLevel FullyAutomated -Confirm:0
}
}
The following PowerCLI one-liner will set all clusters to DRS enabled where DRS was disabled:
Get-Cluster | Where-Object {-not $_.DrsEnabled} | Set-Cluster -DRSAutomationLevel FullyAutomated -Confirm:$false
For your script the if statement should be:
if (-not $cluster.DrsEnabled)
Regards, Robert
Message was edited by: RvdNieuwendijk
The following PowerCLI one-liner will set all clusters to DRS enabled where DRS was disabled:
Get-Cluster | Where-Object {-not $_.DrsEnabled} | Set-Cluster -DRSAutomationLevel FullyAutomated -Confirm:$false
For your script the if statement should be:
if (-not $cluster.DrsEnabled)
Regards, Robert
Message was edited by: RvdNieuwendijk
Worked perfectly, thank you very much.