Script Overview

This enhanced script is based on the Analyze Logon Duration PowerShell script first published on the Citrix blog.  

The major addition to the original script is the "HDX Connection" logon phase, which covers the pre-Windows logon time and includes the HDX connection initialization time. In addition, the Logon Time now reflects the actual connection request time as seen by the XenDesktop Broker and the Session Init phase which cover the session creation process. The new phases are relevant only for the HDX XenDesktop 7.x connections.

With the above mentioned additions, the updated script now covers the entire logon process, from the moment the user clicks on the published resource until the Desktop is available.

The new module works by querying the XenDesktop Monitor service via 0Data API. The Windows session ID is translated to a XenDesktop SesionKey which is used in the 0Data API query.

Script Prerequisites

The following are the script prerequisites:

  • Windows PowerShell 3.0 and above
  • Local administrator privileges (required for querying the local event logs)
  • Read-only administrator role in the relevant XenDesktop site (even if Full admin rights are present, it is recommended to add Read-only rights as well)
  • Enable the auditing of process tracking via GPO or local security policy (secpol.msc) on all target XenDesktop VDA's
  • In order to support "older" user sessions it is recommended to increase the Security log size to 50MB or 100MB
  • Supply Target user session ID as a script parameter
  • Updated Citrix Receiver (on the physical endpoint that initiated the target HDX session)

It's worth mentioning it might take a few seconds for XenDesktop to populate the HDX connection times in the Monitor service database.

Script Output Example

Logon Phases

The following table summarize the logon phases the script covers and the Windows events used for calculating the start and end time for each phase:

Get The Script Now