Posts RSS Comments RSS 253 Posts and 411 Comments till now

Citrix Load Evaluators

I have had a few request for how to deal with Citrix Load Evaluators. There are few gotchas, but it is fairly strait forward.

There are two Built-in Citrix Load Evaluators Default and Advanced.. the problem is that from MFCom, this is not what they are called. This is what you should use.
– Default = MFDefaultLE
– Advanced = LMSDefaultLE

function Set-CitrixLoadEvaluator{
    Param($server = $(throw ‘$Server is Required’),$LoadEvaluator = "MFDefaultLE")

    # Loading Server Object
    $type = [System.Type]::GetTypeFromProgID("MetaframeCOM.MetaframeServer",$Server)
    $mfServer = [system.Activator]::CreateInstance($type)
    $mfServer.Initialize(6,$Server)

    # Getting Current LE
    $le = $mfServer.AttachedLE
    $le.LoadData(1)
    Write-Host "Old Evaluator: $($le.LEName)"
    Write-Host "Setting Load Evaluator on $server to $LoadEvaluator"

    # Assigning New LE
    $mfServer.AttachLEByName($LoadEvaluator)

    # Checking LE
    $le = $mfServer.AttachedLE
    $le.LoadData(1)
    Write-Host "Load Evaluator Set to $($le.LEName)"
}

Trackback this post | Feed on Comments to this post

Leave a Reply

You must be logged in to post a comment.