PowerShell script to Monitor and Log Citrix ICA and ICA RTT Latency for a single user

by Stan Czerno August 14, 2021 13:55 CST

I had a Remote user complain that their Session was slow and unresponsive a few times in the last week. The user was connected to the Internet using Xfinity 5G so Latency was the first thing that I thought of. Her session was currently behaving, so I needed to log her latency to review when/if the issue occurred again. Since I do not run a Citrix ADM appliance, I wrote a script to record the user's latency to a CSV file so I could review it later. I ran it every morning for a week.

The script has some variables you need to configure to capture the latency.

The first variable, $assocuser, is the User you want to collect latency for, in "DOMAIN\Username" format.
The next variable, $DDCName, is one of your Citrix Desktop Delivery Controllers.
Next is the variable, $latencyLogfile, which is where you want to save the Latency info collected
Next is the variable, $MStoBeConsideredLatent, which is what you want to consider latent, in Milliseconds. If you only want to collect very latent samples, set it to a higher number, such as 150 or higher. In my experience, anything over 300ms is problematic for reading Smart Cards (PIV or CAC). Anything over 200ms is problematic with normal 2D application use and anything over 80ms is problematic with 3D application use (assuming you are using a GPU). In my experience, the average latency for most Remote users the U.S. is about 60-80ms. I simply left if to 1 so I could capture everything and create a chart with all the latency.
Next, the variable, $SleepTime, is how long you want to sleep between samples, set to 15 seconds by default.
Next, the variable, $NumofSamples, is how many samples you want to capture, set to 1920 by default.

Link to Script: 

Monitor_Latency_for_single_user.ps1

Tags:

Catergories: Citrix | XenApp | XenDesktop | Powershell

Comments are closed