Get Hyper-V Cluster Automatic Balancing Configurations

# getHyperVLoadBalanceMode.ps1

$clustername=(Get-Cluster).Name
function getHyperVLoadBalanceMode($clustername=(Get-Cluster).Name){

    $AutoBalancerLevel=[hashtable]@{
        '1'='Low | Move when host is more than 80% loaded (default)'
        '2'='Medium | Move when host is more than 70% loaded'
        '3'='High | Average nodes and move when host is more than 5% above average'
    }
    
    $AutoBalancerMode=[hashtable]@{
        '0'='Disabled'
        '1'='Load balance on node joins'
        '2'='Load balance on node joins and every 30 minutes (default)'
    }
    try{
        $level=(Get-Cluster $clustername).AutoBalancerLevel.toString()
        $levelDescription=$AutoBalancerLevel[$level]
        $mode=(Get-Cluster $clustername).AutoBalancerMode.toString()
        $modeDescription=$AutoBalancerMode[$mode]
        write-host "Clustername: $clusterName`r`n - AutoBalanceLevel: $level $levelDescription`r`n - AutoBalanceMode: $mode $modeDescription"
    }catch{
        write-warning $_
    }

}

getHyperVLoadBalanceMode $clustername
# Sample output
PS C:\Windows\system32> getHyperVLoadBalanceMode
Clustername: cluster1
 - AutoBalanceLevel: 1 (default) Low Move when host is more than 80% loaded
 - AutoBalanceMode: 2 (default) Load balance on node join and every 30 minutes

Leave a Reply

Your email address will not be published. Required fields are marked *