SCRIPT: Check ICA Listener response

Last week I was troubleshooting at a customer which was experiencing some “random” periods in which end users could not login at all. When looking at the Load Evaluator I noticed the least loaded server in those periods were the same. When trying to logon to the server through ICA, the server sits forever at connecting…

Instantly I opened a DOS prompt and did a telnet to the servers ICA port (1494).  The server responded and a connection was made, but when I was expecting to see the ICA heartbeat the telnet session stayed blank, this told me the ICA listener is corrupted. I rebooted the server and I came up perfectly. Problem solved you think, not quiet yet.

The infrastructure consisted of 100+ XenApp servers which are provisioned by Citrix Provisioning Services. So potentially more XenApp servers were having a corrupted ICA listener. But entering a telnet session for each server manually was not an option. and scripting a powershell script which launches an external (telnet) process did was not sufficient either. (because is does not report, the telnet output back to powershell). That’s why I searched the internet how to read a “telnet” sessions output. while searching I stumbled upon a blog that needed to do some telnet magic on Cisco devices. I decided to adapt the script for my own needs

After some alteration I ended up with a script that connects to the ICA port (1494) and reports it’s output. I’ve tested it and it work really fine, but you might have to change the TimeOut settings. When a server reports a potential issue you can test it against a manual telnet session.

  •  Test a Single Computer
  • Test-ICA -ComputerName <your computername here> -TimeOut <Time Out in ms>
  •  Test Multiple Computers
  •  101..190 |% {.\Test-ICA.ps1 -ComputerName CTX$_ -TimeOut <Time Out in ms>}

You can also filter output for your needs. Let me know if you appreciate the script.

Download Test-ICA (2238)


9 Comments to “SCRIPT: Check ICA Listener response”

  1. kedar 28 November 2012 at 17:06 #


    i am not aware of ABC of scripting, this script looks good, but i need to be able to get an output for a list of servers in html format. can u help ?

  2. JeffB 3 January 2013 at 00:12 #

    Works like a champ, just what I needed.


    • Shekhar Reddy 6 November 2013 at 20:37 #


      Is this command tested for Multiple Servers, if so can you please share how to execute this command for multiple servers

      Thank Q
      Shekhar Reddy

  3. Anonymous 24 January 2013 at 05:42 #

    do you know ,how the ica listener corrupted ?

  4. Nikhil 18 March 2013 at 05:59 #

    Was able to test with respect to signle computer.Have a 400 servers which need to be tested and details is saved in .txt fiels for server.

    what command should i enter.please help..i am just need to run scripts

  5. Shekhar Reddy 6 November 2013 at 20:36 #

    for single server i am able to execute the command, however i am not able to get how to execute this command for multiple servers. The one which you mentioned for multiple is not clear to understand. If you can help me in this it would be great help.

    Thank Q
    Shekhar Reddy

    • Leon van Efferen 22 January 2014 at 22:19 #

      It depends on how your servers are named, if they are numbered sequentially you could use my sample command. if they are not, you should create a text file containing all your server names. this text file you can read into an array. The command will look something like this:

      Get-Content file.txt |% {.\Test-ICA.ps1 -ComputerName $_ -TimeOut

  6. KN 4 December 2014 at 18:30 #

    very useful script

  7. piotr 3 November 2015 at 12:24 #

    extremely useful script !

Leave a Reply