:::: MENU ::::

Powershell – Check XenApp LoadEvaluator

XenApp 6.0

Powershell – Check XenApp LoadEvaluator

At a customer I was busy checking the servers via the Citrix Management Console wich load evaluator was set. Because the environment contains a lot of servers it is a time consuming job. Therefor I created 2 small scripts.

The first script will do the following.

  • Add citrix powershell Snapin
  • Get a list of XenApp servers in the farm
  • Check for each server wich load evaluator is assigned
  • Write the result to a CSV fileThe second script will do the following.
The second script will do this.
  • Read content from CSV file created by the first script
  • Sort the content
  • Export to HTML file with a style sheet
  • highlight all server with the load evaluator set on Maintenance


Because I am fairly new at scripting I got some help from Ryan Bijkerk who is known of http://www.logitblog.com

Here the samples of both scripts
Check Load Evaluators:

Remove-PSSnapin Citrix*
add-pssnapin citrix*

$Servers = get-xaserver
$date = (Get-date).ToString('ddMMyyyy')
$filepath = "<Path LogDir>"

$i = 0

Add-Content "$filepath\$date-LoadEvalReport.csv" "Servername,LoadEvaluator"

Do {
$Server = $Servers[$i] ; $i++

$Temp = get-XALoadEvaluator -ServerName $server | Select-object LoadEvaluatorName
$Result = $Temp.LoadEvaluatorName 

Add-Content "$filepath\$date-LoadEvalReport.csv" "$Server,$Result"

}While ($i -le $Servers.count -1)

Covert CSV to HTML file:

$date = (Get-date).ToString('ddMMyyyy')
$CSV_filepath = "<Path to logfile>\$date-LoadEvalReport.csv"
$HTML_output = "<Path to logfile>\LoadEvalReport.html"

$style = "<style type='text/css'>
tr {width: 200px; text-align: left; font-family: Arial; font-size: 14px;}
tr.warning {Background-Color: red;}
tr.error {Background-Color: yellow;}

import-csv $CSV_filepath | sort-object LoadEvaluator -descending | ConvertTo-HTML -Head $style | Out-file $HTML_output

(gc $HTML_output) | foreach-object {if ( $_ -match "Maintenance") {$_.replace("<tr>","<tr class=warning>")} ELSE {$_.replace("<tr>","<tr>")}} | set-content $HTML_output

Hope this is handy for some of you guys (or girls ;-)) out there.

One Comment

  1. Dan L

    Thanks alot for this information. Have been trying for about 2 hours now to get information about load evaluator on XenApp servers 🙂


Leave a comment