XenApp Farm Health Report

UPDATE: Version 2 of this script has been released

I recently created a Powershell script to report on several key items in a XenApp 6.x farm and e-mail a health check report. I run this script as a scheduled task on a XenApp server on a daily 7:00 am trigger. It gives XenApp administrators some confidence that the farm is in a good operational state for the day.

The script checks the health of a XenApp 6.x farm and e-mails two reports. The full farm health report is attached to the e-mail and any errors encountered are in an html report embedded in the email body.
This script checks the following:
– Ping response
– Logon enabled
– Assigned Load Evaluator
– ICA port response (at this stage only ICA, not CGP is tested)
– WMI response (to check for WMI corruption)
– Server uptime (to ensure scheduled reboots are occurring)
– Server folder path and worker group memberships are report for informational purposes


  1. tony baker says:

    Awesome Script, any chance of adding free diskspace % with a tolerance level also? thanks

  2. Anonymous says:

    Nice script, like it.

    Checking the XML & IMA service would be worth adding?

  3. tony baker says:

    I have managed adding the PrintSpooler service myself, so checking additional services should be quite simple

  4. Great to hear you like the script. I was planning on adding checking of services, and I like the idea of a free disk space check too. I’ll add this to the “to do list” for version 2.

  5. Anonymous says:

    Can you past the code for adding checking the printer? Appreciate it.

    • tony baker says:

      #Check Print Spooler is Running
      $PrintSpooler=(get-service -computer $server | Where-Object {$_.name -eq “Spooler”} | Select Status)
      if($PrintSpooler.status -eq “running”) {
      $results.Spooler = “Success”
      } else {
      “PrintSpooler Not Running” | LogMe -display -error
      $results.Spooler = “Error”

      Then you just need to output the results to the html file as per the other results.

  6. Version 2 of the script should be out in a couple of weeks and contains more checks including print spooler & IMA service checks

  7. Anonymous says:

    I get: Property ‘spooler’ cannot be found on this object; make sure it exists and is

    When I try and run it, though if I run the command straight from powershell it is fine… :S

    • tony baker says:

      Have you added the relevant code to add it to the HTML? is it possible that is your issue?

      see below:

      writeData $_.ComputerName, $_.FolderPath, $_.WorkerGroups $_.Ping, $_.Logons, $_.LoadEvaluator, $_.ICAPort, $_.WMI, $_.WeeklyReboot, $_.Spooler $resultsHTM

      This will need to be added to all instances of the WriteData….

  8. Anonymous says:

    Yeah I’ve added it there… I think it is the checking part of it that’s causing the problem, but not sure why as I can run the command individually and it works i.e

    get-service -computer xenapp01 | Where-Object {$_.name -eq “Spooler”} | Select Status

    Works…. I’m guessing it’s not liking the $server for some reason.

    • tony baker says:

      Where have you added the snippit I originally posted, it needs to go here:

      Get-XAServer | % {

      $Results = “” | Select-Object ComputerName, FolderPath, WorkerGroups, Ping, Logons, LoadEvaluator, ICAPort, WMI, WeeklyReboot, Spooler, Flash

      $server = $_.ServerName
      $server | LogMe -display -progress
      $Results.ComputerName = $server
      $Results.FolderPath = $_.FolderPath
      $Results.WorkerGroups = Get-XAWorkerGroup -ServerName $server | % {$_.WorkerGroupName}

      #Check Print Spooler is Running
      $PrintSpooler=(get-service -computer $server | Where-Object {$_.name -eq “Spooler”} | Select Status)
      if($PrintSpooler.status -eq “running”) {
      $results.Spooler = “Success”
      } else {
      “PrintSpooler Not Running” | LogMe -display -error
      $results.Spooler = “Error”

      you will probably require amending the following line to match also:

      $Results = “” | Select-Object ComputerName, FolderPath, WorkerGroups, Ping, Logons, LoadEvaluator, ICAPort, WMI, WeeklyReboot, Spooler

      If you wish I can send you the full updated script.


  9. HetRatje says:

    Nice, this works great! Can’t reive the email, that’s a pity.
    I added the SMTP server, to-email and from-email. But nothing! 🙁

  10. shaun@au says:

    Excellent script thanks Jason …
    Found 1 prob, when the XA server is offline (there is bug where XA6 will hang while shutting down, but still respond to ping), it displays below error but still reports success in the script

    Get-Service : Cannot open Service Control Manager on computer ‘CTX03’. This operation might require other privileges.
    At C:tempXenAppServerHealthCheck.ps1:217 char:27
    + $PrintSpooler=(get-service <<<< -computer $server | Where-Object {$_.name -eq "Spooler"} | Select Status)
    + CategoryInfo : NotSpecified: (:) [Get-Service], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetServiceCommand

    Also how do you check the ICA port in the script, it report success as well in above situation although you cannot telnet to port 1494.

  11. Did you released the next version?

    > Sambasiva

  12. Sambasiva, unfortunately I have been busy with other projects and have not fully tested the updated script. It is so close too!

    shaun@au, the script essentially does a telnet to 1494 so I am surprised to hear that the script reports 1494 as available but telnet fails. If you get this situation again and have time to work with me then drop me a message.

  13. Great Script! Any updates???
    Been trying to make some modifications myself with not much success…keep getting errors….I am still new to PS scripting so am learning alot!
    Thanks in advance!

  14. Hi Sonia,
    Finalising the update of v2 of this script has been on my “to do” list for a loooong time! I’ll away on holiday for a while and will try to get something done when I get back.

  15. Anonymous says:

    I am new to PS Scripting as well, but would and have been trying to incorporate the Server Load into this script without much success as well. Is it possible to do this?

  16. Anonymous says:

    Hi Jason. Is there any news on the updated script? It would be a massive help for us PS novices to have this finalised. Also, could you add a test for Session Reliability (2598) too? Many, many thanks

  17. Hi,
    I posted the updated script yesterday:
    It doesn’t have a check for Session Reliability though.

  18. FD says:

    Hi Jason,
    thank you for posting and updating your scritp.
    Here are few lines I modified on v1, that should work even with the latest release in order to add smtp authentication.

    On top, add:

    $emailsend = $false

    $smtpAuthUser = “” # Populate with DOMAINusername to enable smtp auth; fill in the smtpAuthPw too
    $smtpAuthPw = “”

    Replase the send line with:

    if ($emailsend) {
    if ($smtpAuthUser -ne “”) {
    $secpw = ConvertTo-SecureString $smtpAuthPw -AsPlainText -Force
    $authcred = New-Object System.Management.Automation.PSCredential ($smtpAuthUser, $secpw)
    Send-MailMessage @mailMessageParameters -BodyAsHtml -Credential $authcred
    } else {
    Send-MailMessage @mailMessageParameters -BodyAsHtml

  19. Anonymous says:

    Is there a download link to V 1, assuming it is for XenApp 5.

  20. Anonymous says:

    Hi Jason,

    Is there any Script for XenApp5?


  21. Anonymous says:

    Fantastic work! Have been about to script one on my own, as I found yours.
    Still, some socket connections are reported as errors, even if telnet on 1494 is ok.
    Thanks a lot!

  22. Is there a similar script for XA 5.0 on Windows 2008

  23. Anonymous says:

    Trying to get the excluded folders variable to work…
    # Servers in the excluded folders will not be included in the health check
    $excludedFolders = @(“ExcludeServers/servername”)
    Created a subfolder….is it just a text file with servername in it????

  24. sandeep says:

    I need to generate the report where i can pull the user session per application.

  25. zach says:

    This is a birlliant script but does anyone use this script on a remote machine that isn’t a Citrix server. I need to know how to do the remoting of commands and all its doing is sending me an email with the table structure but with nothing in it. Any help would be appreciated, Thanks.

  26. Wholesale jerseys outlet, only $19 Blazers factory.

  27. Vik says:


    Beautiful script however I have seen a bug where it will hang on reaching a server which is not responding/RPC failing, can you please incorporate a timeout value so it doesn’t hung forever.

  28. Thomas Cole says:

    I have seen the exact same problem as “Vik” – “Beautiful script however I have seen a bug where it will hang on reaching a server which is not responding/RPC failing, can you please incorporate a timeout value so it doesn’t hung forever. – See more at: http://deptive.co.nz/xenapp-farm-health-report/#sthash.HtrmPF7L.dpuf

    Do you have a module that handles this?

  29. John Provost says:

    What is EKG_WIDE.JPG and where do I get it?

  30. Ramkumar Govindaraj says:

    Awesome, great script.

    how to add Print server in this script? This is not a xenapp server but a print server for the xenapp environment.

  31. Varunn says:

    Hi Jason,

    Wonderful script.
    However there seems to be an issue when the services are being check. If the services are not installed, the script reports them as “Error”, but not as “N/A”

    In the function CheckService(), the below code does not work.

    if (!(Get-Service -Name $ServiceName -ComputerName $server -ErrorAction Stop) ) { “$ServiceName is not available…” | LogMe -display; $ServiceResult = “N/A” }

  32. Devendiran says:

    Hi I am unable to download the script. I request you to kindly mail me the script to my ID; kdevendiran83@yahoo.in.
    Thanks in Advance

  33. Rahul Paik says:

    Please sent me the script. I am unable to download the script.

  34. Bill Rogge says:

    Please e-mail a copy of the script as it is not downloadable due to a DNS error.


Leave a Reply

Contact Deptive

Deptive - Commercial Bay
11-19 Customs Street West St
Commercial Bay Tower, Level 17, Room 1715
Auckland 1010
We also have a virtual office in Wellington.

Contact Details

0800 000 141

Postal Address
PO Box 34797,
Birkenhead, Auckland 0746