XenApp Farm Health Check v2

My original XenApp Farm Health Check has had great feedback, and thanks to all of you who have modified the script and supplied me with the updated code!
So, finally, version 2 of the script is now available for download. The script has not been extensively tested so please let me know if you have any problems and I will endeavour to help.
The tests performed by this script are:

– Ping response
– Logon enabled
– Assigned Load Evaluator
– Active sessions
– ICA port response
– CGP port response (session reliability)
– WMI response (to check for WMI corruption)
– Citrix IMA, Citrix XML, Citrix Print Manager and Spooler services
– Server uptime (to ensure scheduled reboots are occurring)
– Server folder path and worker group memberships are report for informational purposes
– PVS vDisk and write cache file size

I schedule the script on a XenApp 6.x Controller (ZDC) to run at least once per day (7 am) where it emails an HTML report on the XenApp farm health.
Items in the script that should be customised for your environment are listed near the beginning of the script
Please download the script and provide me with some feedback.


  1. Anonymous says:

    Great stuff Jason, thank you

    TerryV – OSS

  2. Nikhil Vaish says:

    @Jason : ICA dont work properly. For testing purpose i disabled the ICA on one server but still the result in script says success.If i telnet to 1494 its failed.

  3. azza2u says:

    Nice script Jas. I especially like the check for WMI corruption. Only bug I’ve found giving me an issue is the cache disk value will be too big for the variable (int32) if your actual vdiskcache is above 2GB.

    >> $CacheDisk = [int] ((get-childitem $PvsWriteCacheUNC -force).length)

  4. Jason Poyner says:

    Hi Nikhil,
    I have updated to script and cleaned up the port checking code and my testing shows it is working correctly. Please download the script again (you will see it is now v2.1). If you still have issues let me know how did you disabled ICA and performed your test.

  5. Jason Poyner says:

    Hi azza2u,
    Good catch, I’ve updated the script to use a long integer type instead.

  6. tony baker says:

    Is it possible also to run script from a non XenApp server?

  7. Jason Poyner says:

    Hi Tony,
    I haven’t tried it, but you could look at the XenApp 6.5 PowerShell SDK:
    Let me know how you get on.

    • tony baker says:

      Yes, I am aware of that, however all the commands require a -computer paramenter, I think it would be good if this could be set as a variable at the start of the script, or maybe even pass the parameter through to the script from the command line…

    • Jason Poyner says:

      This might help:
      “In order to facilitate running existing scripts remotely without having to make significant changes, a default computer name can be set in the client machine. To do this a new set of cmdlets was introduced. When the default computer name is set, all the cmdlets will automatically remote to the server specified without having to explicitly use the -ComputerName parameter every time.”

  8. Anonymous says:

    Great script to use

    On the farm what I use:
    defaultVDisk = 4 different Vdisk example: (silo + Desktop + DesktopTest, etc.)
    Default load evaluator = 2 evaluator example: (VM Load Evaluator + Silo load Evaluator)

    How can I modify the script to give more Vdisk and evaluator. I try but doesn’t work can you help me.

    Kind regards,

    • Jason Poyner says:

      Hi Hakan,
      I am aware of the need to assign different vDisks and Load Evaluators to groups of servers. Based on the server folder I could check for different vDisks and LEs… but I think this functionality will have to wait for the next version sorry!

    • Anonymous says:

      Having just downloaded and launched this for the first time (Jason, you rock), I’m planning on running two jobs – one for each of my setups/vdisks. I have each build in a separate folder, so I can exclude all folders except the one that fits my variables.

  9. Anonymous says:

    This is awesome, thanks for you effort guys 🙂


  10. Daniel says:

    Thank you for your great job!
    If possible could you add possibility to send an email to abc@domain.com if no errors detected and send an email to another account def@domain.com if errors detected?

    Thank you

  11. Daniel says:

    Sorry, I’ve forgotten to ask you if it’s possible to add some check for web interface.

    You’re the best! =)
    Thank you

    • Jason Poyner says:

      Hi Daniel, thanks for your feedback, but I’m sorry I’m not in a position to be doing more development on the script just at the moment.
      We recommend using NetScaler to load balance and monitor Web Interface – you could look into that. I do like the idea of a basic heath check in this script though…. and a PVS health check…. one day!

    • Daniel says:

      thank you for this usefull script, no problem for web interface.. I’ll try to modify your script… even if I’m not an expert powershell programmer.. I’ll try =)
      Thank you for your response, good job!! Bye

  12. JhayesHuron says:

    Hello Jason,

    Love all the improvements made to the script. Question, is it possible to send to more than one email address? I think my email system is having problems with DL’s.



  13. Anonymous says:


    Great script. Only problem I am seeing is the XML check. The farm is sharing XML with IE (Port 80). No services is in the services list and the script shows an error continuously due to this.

    • Jason Poyner says:

      This is not something I have tested as I never share the XML port with IIS. You could comment out the XML service check (lines 385 – 393) and add: $tests.XML = “SUCCESS”,”N/A”
      This will always return a success status for the XML test with the status text of “N/A”.

  14. Anonymous says:

    Good job Jason.
    I would like to challange you to do a small change to til script however.

    The activesession, counts all sessions (includning pub apps). If a user has one session on a server, but runs 10 pub apps in that session, the count for this user will be 10.. I would like the count in this case to be 1.

    • Jason Poyner says:

      So what you are after is a unique user count rather than an active session count. Try this, find line 335:
      if ($activeServerSessions) { $totalActiveServerSessions = $activeServerSessions.count }
      and change to this:
      if ($activeServerSessions) { $totalActiveServerSessions = ($activeServerSessions | Group-Object -property AccountName).count }

      Let me know if this works….

    • tony baker says:

      Any easy way to have both of these counts? Thanks

  15. Anonymous says:

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

  16. Anonymous says:

    No worries, thanks for putting this out there.

  17. Anonymous says:

    Hello Jason,

    thanks for the excellent script. I made some additions to your script to fit it in our environment. I was trying to sort the html file on one of the Value Fields like FolderPath or Workergroup. Unfortunately with no success. Are you able to help me?

    best regards

    • Jason Poyner says:

      Need the end of the script is this line:
      $allResults | sort-object -property FolderPath | % { writeData $allResults $resultsHTM }

      Just trying change “FolderPath” to another property if you wish to sort by another column.

    • Anonymous says:

      I can put there what ever I want, the html is always sorted by ServerName

    • Jason Poyner says:

      The original script sorts by FolderPath so perhaps the changes you made have altered this behaviour. I suggest trying the original script and changing the sort property. If this works you know it’s your changes.

    • Anonymous says:

      I did test with your original script and the html file is not sorted at all. 🙁
      I have nearly 200 Servers listed in the script.

    • Anonymous says:

      Hello Jason

      I just tried it again with the script I downloaded freshly from your website. I did not bother about configuration on smtp and other settings (no modifications at all). In my environment there is no sorting at all.

      best regards

  18. Anonymous says:

    Hello Jason

    Found a way to get what I need:
    changed the definition of:
    $allResults = [ordered]@{}

    then I do the sorting here:
    Get-XAServer | sort ElectionPreference, FolderPath, ServerName | % {….

    and finally got rid of all other sorting in the script:
    $allResults | % { writeData $allResults $resultsHTM }
    $data.Keys | foreach {……

    I’m still not the PS Crack but it works for me.

    best regards

  19. Anonymous says:

    You Rock Sir!!!! I have used your script to manage my farm and it works like a charm..Salute to you!!

  20. Anonymous says:

    May I suggest using ConvertTo-HTML for all html output, saves a lot of formatting work 🙂

  21. Anonymous says:

    Nice script! Thanks!

    – Workergroups to exclude servers
    – More than 1 mail user to receive report.

  22. RATBORG says:

    Jason – is it possible to send a health check only for specific server names? So if customer XXX has servernames CLDXXX1020 / CLDXXX1030 I only want this script to send the health check over these 10 servers. Can I set a filter?

  23. Gilmar says:

    Hello Jason.

    Your script is very useful.
    In my environment the Power Shell shows mesnagem [Error] Socket connection failed.

    Any idea?

    Thank you.


  24. Anonymous says:

    I have a few XML servers running with IIS on port 443. How would you convert the XML checker to take that into consideration?

  25. Unknown says:

    This comment has been removed by the author.

  26. Anonymous says:

    Jason, Great job 🙂 We think this script is very usefull for our team since we have to check various customers environments every morning. This script saves us a lot of time.

  27. Anonymous says:

    i got this error when executing your powershell script as below.

    PS H:> .XenAppServerHealthCheck_v2.1.ps1
    Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
    At H:XenAppServerHealthCheck_v2.1.ps1:72 char:24
    + [parameter(Mandatory < <<< = $true, ValueFromPipeline = $true)] $logEntry,
    PS H:>

    please assist/help/advise. TQ.

  28. Anonymous says:

    Any thoughts on how I could get a sum of active and disconnected sessions by Workergroup and place those numbers at the top of the report under the total active and disconnected sessions?

  29. Anonymous says:

    I seem to have an issue where ping is timing out, any recommendations for altering things to be a bit more tolerant? My farm is located in two different geographical locations, I have an admin machine in one location running the script, but the other location is across the country and some of those servers are the ones timing out.

  30. Sebastien says:


    I’ve found that script is realy slow on verifing the Service running status for some services because you make for each check a different connection and different query to a server, while you do 5 checks, this causes 5 times two slow actions.

    What you could do instead is before starting to do your first get-service is to get a full list of running processes like this:
    $running_list = Get-Service -ComputerName $server | Where-Object {$_.status -eq “running”} | ft Name

    And then just check if the service exists in the running_list (that will speed up a lot your script and less stress the production servers)

    You would only query once per server in the beginning of your server loop.

  31. Sebastien says:

    Beware my code was difficult to implement.

    I’ve changed it so that you can implement it without a sweat:

    $running_list=[array] 1;Get-Service -ComputerName $server | Where-Object {$_.status -eq “running”} | %{$running_list+=$_.Name}

    Now to check if a service is running you execute this:
    $running_list -Contains “SENS”

    My program runtime was 15 minutes and now it executes in 4 minutes 🙂

    You can do the same with qfarm -load, just execute it once on the first citrix server you can reach and use that list for checking the “load” and “logons enabled”

    Glad I can help you, after you helped me 😉

  32. Tim says:

    This is a great script. Worked perfectly. One thing that I think would be a huge benefit would be if we could run the script based Worker Group or Zones. So something like Get-XAWorkerGroup | where-object {$_workergroupname -eq “OAsia”}

    We have USA, Europe and Asia and being able to get different scripts with specific servers on it would be great.

    Thanks, Tim

  33. Agnel says:

    Hi Jason,

    The script is amazing. Since I have so many folder paths .could you help me in getting the code to sort it by folder path.

    • Jason Poyner says:

      Hi, the report should already be sorted by folder path. Near the end of the script is the line:
      $allResults | sort-object -property FolderPath | % { writeData $allResults $resultsHTM }
      As you can see this sorts the output by the FolderPath property.
      How are you seeing the output sorted?

  34. Jerry Moore says:

    Great script!! How can I filter with multiple folders?

  35. Pavel Stadler says:

    Dear Jason,
    Thanks for inspiration very much. As a PS beginner I slowly try to use your script and to extend it a bit. I found one issue.
    Depending on an installation procedure the “ctxhttp” service is visible or is not visible on a broker server. See please : http://terenceluk.blogspot.cz/2012/07/citrix-xenapp-65-server-missing-citrix.html

    So perhaps and additional check has to be done (registry check). So in case a registry check is OK some text like “IIS Integration” should be used (not an error).

    Kind regards,
    Pavel Stadler

    P.S. Additional inspiratin scripts:

    • Jason Poyner says:

      Hi Pavel,
      Yes that is a limitation of the script. Given the move to XenApp 7.5 it’s unlikely I’ll be developing this script much more… I will rewrite it for XD7.1 / XA7.5 at some stage though!

  36. Ranjith says:

    I am new with Power shell script, In my environment we’re having few CampusVue citrix server, Using your attached script where can i add the server.txt file.

    please assist AEAP.

  37. Jon says:


    I am trying to understand how would I input my email info in this location. Should I change the $emailFrom to $myemailaddress@xyz.com and similarly for others?

    $mailMessageParameters = @{
    From = $emailFrom
    To = $emailTo
    Subject = $emailSubject
    SmtpServer = $smtpServer
    Body = (gc $resultsHTM) | Out-String
    Attachment = $resultsHTM

    • Jason Poyner says:

      Hi Jon, at the beginning of the script you will see this:
      # E-mail report details
      $emailFrom = “alerts@acme.co.nz”
      $emailTo = “alerts@acme.co.nz”
      $smtpServer = “mail.acme.co.nz”

      Change “alerts@acme.co.nz” and “mail.acme.co.nz” to the appropriate values for your company.

  38. Jon says:

    Thank you Jason.

  39. Keith says:


    Possible to include the Citrix Profile Management Service into this script?

  40. Matthew Gore says:

    How do you get the $excludedFolders = @(…..) to accept multiple folders?

  41. Vitaly says:

    Active sessions calculation issue:
    $activeServerSessions = [array]($sessions | ? {$_.State -eq “Active” -and $_.Protocol -eq “Ica” -and $_.ServerName -match $server})
    $activeServerSessions = [array]($sessions | ? {$_.State -eq “Active” -and $_.Protocol -eq “Ica” -and $_.ServerName -eq $server})

  42. Colin says:

    Hi Jason

    Great script.
    I have managed to modify it to run on 4.5, 5 and 6.5 as well as adding a few extra checks then join them all together.
    Took our morning checks from an hour to 10 mins.
    Thanks for the great starting point and getting me a ton of brownie points with my manager.

  43. Ed Miller says:

    I would LOVE to know how this can be modified to run on a 4.5 farm as well?

  44. Mike says:

    Is there a way to get this to work with Xenapp 7.5.

  45. ismael says:

    In the output what does the server load number translate to? what does the number mean?

  46. Scott says:

    Great script.. Is there a simple way to output the results as an Excel spreadsheet?

    • Jason Poyner says:

      Hi Scott, it could certainly be done, but would require some work. If you’re good with PoSH it shouldn’t be too hard.
      All the results are stored in the $allResults hash table (the data structure is described within the script). The WriteData function takes the hash table and writes out HTML – this function could be copied and modified to write out to csv instead.

  47. Empyre says:

    Jason, wonderful script. It helped me identify why 6 of the 200 servers were having issues with connections. either the IMA service was not starting or ICA was bad.

    Now were are trying to focus on Disk Space.
    Would you be able to help me add a piece to the script that gives disk free size, this is what I’ve been using:

    # Issue warning if % free disk space is less
    $percentWarning = 15;
    # Get server list
    $servers = Get-Content “d:ScriptsPSCheckDiskSpaceAllServers.csv”;
    $datetime = Get-Date -Format “yyyyMMddHHmmss”;

    # Add headers to log file
    Add-Content “$Env:USERPROFILEserver disks $datetime.txt” “server,deviceID,size,freespace,percentFree”;

    foreach($server in $servers)
    # Get fixed drive info
    $disks = Get-WmiObject -ComputerName $server -Class Win32_LogicalDisk -Filter “DriveType = 3”;

    foreach($disk in $disks)
    $deviceID = $disk.DeviceID;
    [float]$size = $disk.Size;
    [float]$freespace = $disk.FreeSpace;

    $percentFree = [Math]::Round(($freespace / $size) * 100, 2);
    $sizeGB = [Math]::Round($size / 1073741824, 2);
    $freeSpaceGB = [Math]::Round($freespace / 1073741824, 2);

    $colour = “Green”;
    if($percentFree -lt $percentWarning)
    $colour = “Red”;
    Write-Host -ForegroundColor $colour “$server $deviceID percentage free space = $percentFree”;
    Add-Content “$Env:USERPROFILEserver disks $datetime.txt” “$server,$deviceID,$sizeGB,$freeSpaceGB,$percentFree”;

  48. Brian says:

    Is the latest script from March of 13?

  49. Ravi says:

    Thanks great script,
    But its showing the active sessions and server load 0.
    How do i get those info.

  50. Bilal Awan says:

    Hi Jason,
    Great work and lot of appreciation.. i just need to ask how to configure multiple recipient in email.
    $emailTo = “alerts@acme.co.nz” ??

  51. Sjoerd says:

    Great script! Also saved me lots of work trying to do the same.
    I have copied the script and adjusted it for monitoring Remote Desktop Services 2012. Many thanks to Jason Poyner.
    Check it out!

  52. Mike says:

    Hello Jason,

    Thank you very much for this wunderful script. It works great.

    Question: The LoadEvaluator column shows in the htm output all “Default” entries in the color orange. How does the color change to green? How can I Change that?

    # Default load evaluator assigned to servers.
    $defaultLE = “Server Default”

  53. […] Poyner made a great script to monitor the XenApp server Farm health on a regular […]

  54. John Foster says:


    Thanks for the awesome script. It works great after some small changes for our environment. I wanted to use this script as a tool for a few helpdesk guys, however it seems they need elevated (Admin) rights to get all the results. Can you confirm what the minimum privileges are required (Citrix & MS) to get full results on a small group of 10 server.

    What I’m seeing is some tests come back OK but others (the services, ICA, IMA and so on) do not.



  55. Joe says:

    Great script. Thank you for your hard work.

    Question for you regarding the uptime… is that in minutes?
    What does it mean when it is at zero?

  56. Kim keith says:

    Hi greate tool.

    Going to make one for XA/XD 7.5 ?

  57. buzz says:

    having some issues with the script. It runs fine but doesn’t list all servers in the farm. It reports number of active sessions and disconnected sessions and default load evaluator.

  58. […] if you don’t know it until now, you really need have a look on his blog and on the Script on http://deptive.co.nz/xenapp-farm-health-check-v2 […]

  59. Sacha says:

    Jason, I really love this script! I adore your work 🙂

    I hope you don’t mind that I re-used your “Framework” to create a PVS-Health Check script:


  60. Diwan Dhami says:

    Need script for daily checks

  61. DD says:

    Very useful script

  62. Rahul Sharma says:

    Great Script !!

  63. G says:

    Great script!
    How can I modify the script to monitor write cache on RAM?

  64. […] you need a Health Check Script for XenApp Version which are older than XenApp 7.x see http://deptive.co.nz/xenapp-farm-health-check-v2 where it’s an excellent work and the inspiration for my […]

  65. JMondo says:


    If you are still having issues with the drive space, try this:

    Add the function to get the disk free space and percentage. we only have this on the C: drive:

    Function Get-DiskSpace
    Param ([string[]]$servers)
    Foreach ($s in $servers)
    Get-WmiObject -Class win32_volume -cn $s -Filter “DriveLetter=’C:'” |
    Select-Object @{LABEL=’Computer’;EXPRESSION={$s}},
    driveletter, label,
    @{LABEL=’GBCapacity’;EXPRESSION={“{0:N2}” -f ($_.Capacity/1GB)}},
    @{LABEL=’GBfreespace’;EXPRESSION={“{0:N2}” -f ($_.freespace/1GB)}},
    @{LABEL=’PercentFree’;EXPRESSION={“{0:N0}” -f (($_.freespace/$_.capacity)*100)}}
    } #end foreach $s
    } #end function Get-DiskSpace

    Then under the main script section add the reporting:

    # Check Drive Space
    $C_Drive_Space = ((Get-DiskSpace $_.ServerName).GBFreespace -as [int])
    if ($C_Drive_Space -ge “5.00”) { $tests.c_drive_space = “SUCCESS”, $C_Drive_Space}
    if ($C_Drive_Space -lt “5.00”) { $tests.c_drive_space = “ERROR”, $C_Drive_Space}

    # Check Drive Free Space
    #$C_Drive_Free = (((Get-DiskSpace $_.ServerName).freespace/(get-diskspace $._servername).capacity)*100)
    $C_Drive_Free = ((Get-DiskSpace $_.ServerName).PercentFree -as [int])
    if ($C_Drive_Free -ge “10”) { $tests.c_drive_free = “SUCCESS”, $C_Drive_Free}
    if ($C_Drive_Free -lt “10”) { $tests.c_drive_free = “ERROR”, $C_Drive_Free}
    # @{LABEL=’PercentFree’;EXPRESSION={“{0:N2}” (($._freespace/$_.capacity)*100)}}
    # $PercentFree=@{name=”PercentFree(%)”;Expression={[int](($_.FreeSpace/$_.Size)*100)}}

    Don’t forget to add your reporting columns.

  66. JMondo says:

    Jason – thanks for the great script. I’m trying to get the section working that writes only the errors to a separate log. So far I’m only getting all or nothing. Has anyone else been able to get this working?

  67. Rishi says:

    script for Xenapp farm is very useful and great work you have done so far. Vdisk column is not green and I am monitoring two vdisk with this script. Can you do let me know what changes I can made.

  68. sarvajeet singh says:

    very very helpful . Thanks lot

  69. sudhakar says:


    I tried to implement this script. When I run it separately I get the correct output. But when I run it as a scheduled task from the same machine, I get lot of errors in the output HTML file. Is there anything that needs to be checked? I am thinking that WMI communication problem as the errors are coming only for the services like IMA, spooler etc. But, the problem is it does not happen when I run it manually from a powershell prompt.

    Any ideas?

  70. sudhakar says:


    Yes. Domain admin credentials. I am using the same credentials when I run it as a power shell script directly and also like a scheduled task. For some one reason, the output when the scheduled task is run has many errors for services, even though the services are up and running fine.

  71. sudhakar says:

    Also, it does not read Write cache size and vdisk is showing as N/A. I wonder if it is unable to reach out to WMI. I removed the WMI part from your script as it was not required for me. So could not see them in the report.

    Only thing that surprises me is the fact that from same server and same credentials and it works fine if I run in from powershell directly.

  72. Jason says:

    can we run this script on CPS 4.5?

  73. Michiel says:

    If you are working with hash tables in Powershell you cannot sort it because it is handled as one big object.
    If you want to sort the results you have to change the code in the writedata function. Change the line:
    $data.Keys | sort | foreach {
    $data.Keys | Sort-Object {$data.$_.folderpath[1]},{$_} | foreach {
    and it will sort on silo first, computername next.

    Hope this helps.

  74. simion says:

    Nice script. Can you able to add for ” unique users” to this script?

    I can get the unique users by the following command but not sure where to put the results on this HTML Page

    get-xasession | ? {$_.accountname -ne “”} | select accountname | sort accountname | get-unique -asstring

  75. Jazz says:

    Thank you, Jason, for the wonderful script. We have three XenApp 6.5 farms, each comprising 0f 1450 servers. Is there a chance that my Zone Data Collector get hammerred if I run this script (ZDC has three 2.67 GHz processors and a 16 GB RAM)? Thank you for your time!

    • Jason Poyner says:

      I do not believe the ZDC will be hit too hard. While the script does query farm info via the ZDC, it also queries each server directly for the state of services etc, this means there is a period of time between farm queries.

  76. Bob says:

    Awesome script!

    However, when I am running it against a XenApp Farm with 50 servers, it takes over an hour to run…………..is that expected?

  77. Mayur Agrawal says:

    Dear Jason Poyner,

    I’m new for PowerShell, can you please guide me step by step how can I add Exclusion list.

    I have created one folder Servers and inside that another folder Test. I created one text file inside Test folder named Server and have list down the hostname to whom I wanted to put on exclusion. But I failed. Can you please help me.

    • Jason Poyner says:

      Hi, line 65 of the script needs to be edited. The line looks like this: $excludedFolders = @(“Servers/Test”,”Servers/Turned Off”)
      The path “Server/Test” reflects the path within the Citrix AppCenter console. For example, place all XenApp servers to be excluded from the report into Servers > Excluded within AppCenter, then change line 65 to: $excludedFolders = @(“Servers/Excluded”)

  78. Angel says:

    Hi Jason,
    Great PowerShell script. It runs great and I am able to get email but there is a small bug that is driving me crazy. Maybe when you have some free time you look at this?
    When I run the script I get the following error:
    Mcli-Get : The specified Store does not exist.
    + $storeid = Mcli-Get store -p storeName=$storename | Select-String storeId
    + CategoryInfo : DeviceError: (:) [Mcli-Get], EAException
    + FullyQualifiedErrorId : InvalidStore,McliPSSnapIn.McliGet

    and I also get this:

    Mcli-Get : The guid parameter is not valid.
    + $alldisks = Mcli-Get disklocator -p siteName=$siteName, storeId=$storeid_short | …
    + CategoryInfo : DeviceError: (:) [Mcli-Get], EAException
    + FullyQualifiedErrorId : InvalidParameter,McliPSSnapIn.McliGet

    Any insight will be greatly appreciated. Thank you.

  79. Reddy says:

    Hi Jason,

    Great PowerShell script. It runs great but i m not able to get write-cache size details. could you please suggest me which below values need to change??

    # Relative path to the PVS vDisk write cache file
    $PvsWriteCache = “d$.vdiskcache”
    $PvsWriteCache2 = “d$vdiskdif.vhdx”
    (No result for WC, if i didn’t change these values )

  80. Wez Nagwama says:

    Hey Jase,

    Awesome work. I created about 25% of this scrip today before googling around and finding your site ha.

    I like your idea of performing the TCP connection to port 1494, but then streaming the data to check for *ICA*. I was trying to think of a way of redirecting telnet to stdout but it can’t be done, so I’m going to steal that 🙂 ha.

    My script also performs an invoke-webrequest on the XML brokers to ensure the correct HTTP response is given, would that be of interest? Thanks mate.

  81. Luis says:

    I have checked the version 2 and looks great, excellent job, also I have made some visual modifications just to meet some internal requirements, my question still no possible to have an array for 2 or more LE or vDisks?


  82. Luis says:

    Sorry, didnt check I was using a previous version

  83. Luke says:

    Hey – great script. I want to run this on an admin server (a non-ZDC) how can I get the script to point towards the ZDC for the information?

  84. Ben says:

    Great Script!!

    How do I get the report to only show errors?

    i have uncommented the # Write only the errors to an html file section and changed the below to use the $errorsHTM but am still getting all the results??

    $mailMessageParameters = @{
    From = $emailFrom
    To = $emailTo
    Subject = $emailSubject
    SmtpServer = $smtpServer
    Body = (gc $errorsHTM) | Out-String
    Attachment = $errorsHTM


  85. List says:

    Hi, good job Jason.

    I have the same issue as Ben. It would be great just to have just the ERRORS in the HTML, not all servers.

    Any ideas?

  86. List says:

    I’ve managed to adjust the code so that the report can now only return errors instead of all results.

    $allErrors =@{}
    $allResults.Keys | % { if ($allResults.Item($_).Ping[0] -eq “ERROR” -or $allResults.Item($_).Serverload[0] -eq “ERROR” -or $allResults.Item($_).Logons[0] -eq “ERROR” -or $allResults.Item($_).ICAPort[0] -eq “ERROR” -or $allResults.Item($_).CGPPort[0] -eq “ERROR” -or $allResults.Item($_).IMA[0] -eq “ERROR” -or $allResults.Item($_).CitrixPrint[0] -eq “ERROR” -or $allResults.Item($_).WMI[0] -eq “ERROR” -or $allResults.Item($_).XML[0] -eq “ERROR” -or $allResults.Item($_).Spooler[0] -eq “ERROR” -or $allResults.Item($_).Uptime[0] -eq “ERROR” -or $allResults.Item($_).WriteCacheSize[0] -eq “ERROR” -or $allResults.Item($_).vDisk[0] -eq “ERROR”){$allErrors.add($_,$allResults.Item($_)) }}

    also a small bug

    $tests.WriteCacheSize = “ERORR”, $CacheDiskGB

    should be

    $tests.WriteCacheSize = “ERROR”, $CacheDiskGB

  87. JulianABR says:

    Hi Jason. I’m from Brazil. Congratulations for your script. I have some doubts. Is possible to run this script in a machine outside the farm? I downloaded and installed XenApp 6.5 Powershell SDK – Version 6.5. When I try to run script from this machine (it’s not a XenApp Server) powershell only returns error saying that I had to be and Administrator of farm.
    So I enter in one of the XenApp Servers and set the execution policy of Powershell Unrestricted for machine and current user. My user is a admin of Citrix Farm. Windows Firewall is turned off. I already started the “Citrix XenApp Commands Remoting” service. But Powershell always returns the same error. Access denied and say that I had to be an Administrator. I had to run this script from a XenApp Server?

  88. Jerome STIVAL says:


    Many thanks for this pretty script.

    Did you know if it’s possible to use it to monitoring more than 1 farm ?

    I have 5 farms XA6.5 and i would like to use only one script if it’s possible.

    Did you test that before ?

  89. Kim says:

    Hi im new to Powershell and nice script mr. Poyner

    What is that i need to put into $defaultLE = “Servers”

    # Default load evaluator assigned to servers. Can have multiple values in format “LE1”, “LE2”,
    # if a match is made to ANY of the listed LEs SUCCESS is returned for the LE check.
    $defaultLE = “Servers”
    The default load evaluater is just called default ? …is it the xenapp farm name ? og just default ?
    under my Xenapp servers folder..the folder is called Servers…is it that one the needs to be there ?

  90. Munvar says:

    Hi Jason, Brilliant script, very useful for me on daily basis health check report, great job. Thank you very much,

  91. Frank says:

    Super script, just a few modifications and it provided all useful info about my XA6 farm in the blink of an eye.

  92. GP says:


    Thanks for the above script.. and I ran the script and got the exact output for my project…
    I need the same kind of script for presentation server 4.5 machine… anyone can help me on this…? Still we are supporting few 4.5 Citrix presentation servers

    Appreciate your help if anyone can help me…

  93. […] March 15, 2016 XenApp Farm Health Check v2 […]

  94. Gerald says:

    I just wanted to comment on how useful this script has been for my 3 XA65 farms. Saves me a ton of time each morning being able to take a peek and identify problem servers.. I have also modified the script to pull licensing information, total server count, added UPM and RDP service checks.

    Only issue I have is once in a while it hangs on a server for one reason or another, the report wont finish. Is there an easy way to timeout the check on a server so the rest of the script runs and a report generates?

  95. Michael says:

    Thank you for this great script.
    We “monitor” multiple XA5 and XA6 farms with the same script. I customized the script to check the XA-version and there are some columns that are only displayed if it’s a XA6 farm (the checks are not run).
    On our german farms the cpu-check does not function well because of translation problems (just meant as a hint).

  96. Glen Maguire says:

    This script has been a lifesaver for me. Thank you!

  97. Jens says:

    Hey @ ALL 🙂
    Has anyone a working downloadlink for the v2 Version?
    Thanks a lot!

  98. Rahul says:

    SUper….. but unable to download the script. Please assist

  99. Michael says:

    the download links isn’t working anymore. Could you please edit the right link into.

  100. martin says:


    Can you send me the link to download the script please as the link isn’t working

  101. Srini says:

    Download link not working anymore

  102. […] reporting script that I’m running for all XenApp servers (modified from the script available here) I run the following to build a hash table of the RAM cache sizes for all […]

  103. Combat Wombat says:

    Would love to implement your script, but your download link is broken.


  104. Mat Harts says:

    Cannot download the Script

  105. Richard says:

    has anyone tracked down this script the link is still kapput >

  106. Srikanth says:

    “Download the script” is not working.

  107. shambhu says:

    Hi ,

    If we have to exclude some servers from the Health report, what we have to do?

  108. sivakumar says:

    hi, will this script will work for 7.9 version of citrix server please update it soon ,Thanks in advance

  109. Shankar says:

    Hi thanks a lot for creating this amazing script. Please let us know what are mandatory change we need to make to run in our citrix environment for xen ap6 and 6.5 related farm.

  110. […] relevant If you need a Health Check Script for XenApp Version which are older than XenApp 7.x see http://deptive.co.nz/xenapp-farm-health-check-v2 where it’s an excellent work and the inspiration for my […]

  111. […] Jason, if you don’t know it until now, you really need have a look on his blog and on the Script . The mentioned XenApp Farm Health Check Script gave me the inspiration to create a similar Health […]

  112. Nitin says:

    Thanks for created superb script.
    If you have the script to “log off the disconnected session on a server”, kindly share me.

  113. Matthew Fritz says:

    I need help changing the $update.days calculations to $update.hours. I have made several attempts to change script and servers that have been up for 18 days are showing a value of 15. I need final output to be in hours instead of days. Any help would be appreciated

Leave a Reply

Contact Deptive

Plaza Level (Regus)
41 Shortland Street
We also have a virtual office in Wellington.

Contact Details
0800 000 141

Postal Address
PO Box 34797,
Birkenhead, Auckland 0746