Citrix: Powershell script to list active thin clients

I was working on a project and one of the sys admins wanted to display which thin clients where logged on, so we made a powershell script to export all active thin clients to a txt file. He could make a script that would enumerate that txt file into HTML to display the occupied thin clients on a screen at the entrance so employees could determine which client they could use that day.




Here’s the script, it’s pretty straight forward: It gets the Citrix.XenApp.Commands snapin if it’s not already in place and lists the information based on active ICA sessions and the only when the client name starts with TCL (Thin Client names based on the naming conventions for this customer).

Output is as following:

ClientName : TCL0004

ClientName : TCL0003

ClientName : TCL0001

ClientName : TCL0002

ClientName : TCL0008

I can’t published the script to enumerate the txt file as it contains to much customer details but I’m sure this is a good start to create the same interface for your users. In this case we used RES Automation Manager to run the script every 5 minutes so employees would know where they could work.

The following two tabs change content below.

Kees Baggerman

Kees Baggerman is a Staff Solutions Architect for End User Computing at Nutanix. Kees has driven numerous Microsoft and Citrix, and RES infrastructures functional/technical designs, migrations, implementations engagements over the years.


  1. Jeff Wouters says:

    Hi Kees,

    The executionpolicy for PowerShell is something that, in my opinion, should be set by a policy and not in each script. Now you would get a message where you would have to confirm that you want to change the exectution policy.
    But in case you do want this to be included in your sript, some recommendations:
    To avoid that nasty confirmation message, use the -force parameter.
    Set the execution policy on the leven you desire. Right now the default (LocalMachine) will be used where (i think) process or currentuser level should suffice in this case?

    And last… very good idea and code 😀


    • k.baggerman says:


      I agree on setting this via GPO but sometimes you just don’t have access to these GPO’s or sys admins don’t want to set this so that’s why I’ve added the first line, thanks for the tips on the confirmation message and the execution policy level.



  2. Alain Assaf says:

    If you have EdgeSight installed, you can run some queries to find the thin client devices that are connecting to your Citrix farm(s). I go into detail in this blog post:


Leave a Reply