This is a guest post from Trentent Tye, Sr. Technical Evangelist for ControlUp and Citrix CTP

Getting to the root cause of slow logons has never been easier, and now it’s updated to identify all phases of a Citrix logon, and lots more!

How long are your logons . . . really?

For years, I worked for one of the largest Citrix-based healthcare customers in Western Canada. Because of the strict security requirements in the healthcare industry, our organization was structured around short idle and disconnect timers, which meant we had tens of thousands of logons per day. With this kind of volume, saving just a single second per logon could mean hours of productivity given back to users. This led me to examine our logon process and scrutinize its details.

When I was doing this, however, there wasn’t an easy way to break down the logon phases into snackable bites. Online discussions about logon durations were inconsistent — people would start and stop timing at different points, and so comparing notes was difficult. There were tools on the market that could measure logon duration for you, but their results were only comparable to users who used the same products.

Enter the Analyze Logon Duration script.

In 2015, ControlUp, a Citrix Ready global partner, spearheaded a community effort to provide an open-source, open-use solution to this problem. The result of this work (done at the time by Niken Koren) was the Analyze Logon Duration (or ALD) script. With its arrival, system admins everywhere could download this script, run it, and measure their results against others. Because the script is free and open source, understanding when a start or stop event was measured was suddenly consistent for everyone.

Fast forward a little and the script evolved in numerous ways. Fully overhauled by Guy Leech in 2018, the script became multi-threaded, and I was personally able to contribute some features to it, including FSLogix profile timings and how long printers could take to map to a session.

This brings us to 2020 and a bit of a shift in the importance of analyzing logon durations and the ways that they are measured.

We’ve always measured logon duration from the point at which a user connects to a Windows session. Technically, this is a good place to start, because this is an area where we, as admins, have the most control.

But from the end-user perspective, this is not when they “start” the application/desktop.

It’s all about perspective.

Your end users start timing when they click on a resource. Citrix has always provided a wealth of acronyms with some descriptions of logon phases, but flushing out the actual start/stop events is difficult. Eventually, Citrix added phases with better descriptions to provide a better understanding of start/stop events. Looking at these, ControlUp was challenged to see if we could pin down the “start” event to coincide with when a user clicked on a resource.

I Get by with a Little Help from My Friends

I did some experimenting and reached out to Guy Leech (a fellow Citrix CTP and all-around IT wizard) about some of my findings; he was able to independently verify the results. We could track from the point at which a resource is clicked and the ICA file is downloaded. But Guy took it a step further. He created a virtual channel driver that made it possible to add a programmable delay. With this, we were able to determine an additional pre-session phase! I can’t stress enough what a stroke of brilliance this was; we now had a ton of confidence in what these phases were.

In short, this was BIG.

With the identification of this new phase, we are now able to suss out two additional pre-phases:

  • When a user clicks on a resource to when the ICA file is delivered
  • When the ICA file is ingested by Citrix Workspace to when it is ready to open a session to Windows

On top of these improvements, Guy and I discovered how to pull this information without querying Citrix’s oData. Querying oData was added to the script to try and pull one of these pre-phases, but doing so required a credential prompt. The new method of pulling the data removes this requirement, making the script easier to run.

What’s New

With all that, what’s new?

The biggest change to highlight in the ControlUp Analyze Logon Duration script is that we can now measure two “pre-Windows” phases of a Citrix session. The first is measured from when a user clicks on a resource to when the ICA file is downloaded. The second phase is measured from when the ICA file is ingested by Citrix Receiver or the Citrix Workspace app, the virtual drivers start and the remote session commences.

Because we can measure these phases and break them down, we can identify some interesting things that wouldn’t otherwise be visible in the Windows Duration breakdown. For instance, Citrix updated the Citrix Workspace App to reach out and share telemetry during the logon process. What’s the impact of this change? Ideally, it should be minimal, and with good network conditions it isn’t noticeable:

But with poor network conditions or blocking or slowing traffic at the firewall, however, it definitely has an impact. Simulating these conditions showed me that this change can have an impact on the second phase “ICA File Opened until Remote Session Commences”

Previously, measuring its significance was nearly impossible. Now, it’s visible and front and center.

With this added to the Analyze Logon Duration script, the complete output is as shown in the image below (click the image to view larger):

The ControlUp ALD script has been updated to make understanding the output easier, too.

The “interim delay” has been renamed “gap,” as this term is easier to understand; there is a new “Source” field that highlights what generated a duration event; the top “Duration” is now measured from when the user clicked on a resource to when the session completed; and “Windows Duration” is the total of the previous “session summary.”

How To Use It

Prerequisites

For the data to be processed, it must first exist. To get the most out of the ALD script, we need to enable some Windows Group Policies to generate this data. Auditing of process start and stop events must be enabled, Command Line Auditing must be enabled, and Microsoft-Windows-PrintService/Operational logging should be enabled.

Execution

So you can get the most data out of it, the script puts a multitude of parameters at your disposal. ControlUp is configured to auto-populate these when it’s run within that tool, but because this is a PowerShell script, it can be run externally. Local administrator rights are required.

Download and save the script, then execute it on the local machine with the following parameters:

. ALD.ps1 “%domain%\%username%” %sessionID% %sessionName% %ClientName%

The parameters can be found in the task manager.

Frequently Asked Questions

Cool! Where can I get it?

The Analyze Logon Duration is available from the ControlUp Script Library or via the Script Actions pane within ControlUp.

What phases does it track?

  • Citrix
  • Windows
  • FSLogix
  • Printers
  • App Volumes
  • Shell
  • VMware
  • Ivanti EM

What are “AppX: Load Packages”?

AppX packages — also known as Windows Universal Applications — are applications built using Microsoft’s “modern” platform. These include applications like “Settings”, “Photos” and more, which are becoming more prevalent with each new release of Windows. These built-in applications can delay logons because they require per-user initialization, which happen at user logons. This phase is more often noticed for Windows 10 logons — especially with non-persistent desktops — because initialization of the applications occurs for users who have never logged into that desktop before. Windows Server operating systems handle AppX packages differently and are generally not penalized by AppX packages loading at logon.

Citrix PRO TIP! If you want to limit the impact of AppX load packages, Citrix Optimizer can really help you out. Citrix Optimizer, created by my friend Martin Zugec is a tool to help Citrix administrators optimize various components in their environment, most notably OSes with Virtual Delivery Agent (VDA). It’s PowerShell-based (which makes it work great with ControlUp), and includes a graphical UI. (Learn more about all the ways it can help make your admin life easier.)

It’s said that it’s the little things that matter most. Minimizing the time it takes to logon to systems is one little thing that makes a huge difference to business continuity. With the ControlUp Analyze Logon Duration script, you can help keep teams happy and productive and spend time doing the work you actually want to do!


Citrix Tech Bytes – Created by Citrix Experts, made for Citrix Technologists! Learn from passionate Citrix Experts and gain technical insights into the latest Citrix Technologies.

Click here for more Tech Bytes and subscribe.

Want specific Tech Bytes? Let us know! tech-content-feedback@citrix.com.