Updated: 02/09/2016 – Fixed multiple bugs, added disk space monitoring and now using PowerShell remoting so the script no longer needs to be run directly on a Citrix Server

Details

Recently I had a need for a tool that would easily allow me or our Service Desk to monitor the health of our XenApp farm, there are obviously commercial products for this but I just needed something simple and free so I created this PowerShell script.

I have been running this on XenApp 6.5.

The script shows,

  • The total number of users logged onto the farm.
  • Each servers uptime
  • Each servers number of logged on users
  • Each servers Citrix load metric
  • Each servers RAM usage %
  • Each servers CPU usage %
  • Each servers C: drive free space – Added 02/09/2014
  • Each servers Logon Mode
  • (Optional) If each server is currently a member of a give publish desktop
  • (Optional) The script also allows you to monitor CPU and RAM usage on a short list of other servers such as Store Front and SQL servers.

Parameters

At the top of the script the follow parameters can be set as needed

ManagementServer = The name of a Citrix server the script will transact with

REFRESHINTERVAL = how many seconds the script should wait after getting to the bottom before starting to starting from the top again

EXCLUDESERVERS = a comma separated list of Citrix servers to exclude from being monitored

ServerDesktopName = The name of the published server desktop you wish to check id servers are a membr of, this can be left blank

CheckAdditionalServers = true / false Do you want to define a list of exta servers to monitor CPU and RAM on such as SQL servers

EXTRASERVERS = The list of additional not Citrix servers to monitor

Running the Script

The client running the script will need XenApp PowerShell SDK (at least version 6.5) installed https://www.citrix.com/downloads/xenapp/sdks/powershell-sdk.html

I generally run a PowerShell script like this powershell -file <patch to XenApp Health script>

If you get a message like the below you  will need to run set-executionpolicy remotesigned cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details.

The Script