Finding the Average Group Policy Processing Time Using Microsoft PowerShell V1.0

On a recent project, we thought the group policies being applied were causing slow user logons and application launches. What we needed was a way to determine how long just group policy was taking to process. This article shows how we determined the amount of time group policy was taking.

Update 21-Mar-2016: A reader from New Zealand reported the script did not work for him. Get-WinEvent returned nothing for the Message property. Turns out that is a known bug according to this post on Stack Overflow. If your PowerShell version is later than version 2 or if your culture is not en-US, then the Message property contains no data. There are two possible work-arounds:

1. Start your PowerShell session with the parameter -Version 2. i.e. PowerShell.exe -Version 2
2. Add the following line to the script:

[System.Threading.Thread]::CurrentThread.CurrentCulture = New-Object "System.Globalization.CultureInfo" "en-US"

Thanks Carl B. for taking the time to report this and help test the two work-arounds.
End update

This project and article are specifically for Citrix XenApp 6.5 running on Microsoft Windows Server 2008 R2 but can easily be adapted for other Windows versions and Citrix XenApp products.

For Windows Server 2008 R2 and Citrix XenApp 6.5, there were 81 group policy events logged for my user account starting with event ID 4001 and ending with event ID 8001.

4001:

Starting user logon Policy processing for Domain\cwebster.
Activity id: {119cd8d1-65d0-480c-8a5e-92d007ccb380}

8001:

Completed user logon policy processing for Domain\cwebster in 5 seconds.

All I was interested in was the number of seconds recorded for event ID 8001.

I needed a script that would:

  • Run remotely
  • Get a list of all XenApp 6.5 servers in the farm
  • Make sure the server was online
  • Look only for event ID 8001 in the Microsoft-Windows-GroupPolicy/Operational event log
  • Capture just the numeric value from the event
  • Display the Average, Minimum and Maximum group policy processing time

Could the script be changed to work with XenApp 7.x? Sure. Could the script be changed to work with an input file of computer names? Sure. So why didn’t I do all that? The customer is paying me to solve their issues, not write scripts. If I ever find the time, I will update the script so it can be used with XenApp 7.x or an input file.

Note: Thanks to Daniel R. from the myITforum PowerShell list for the help in finding out how to access the proper event log.

The script should be able to work as a scheduled task. The script is designed to be run directly on a ZDC and works with PowerShell V2. On average, the script processes almost 6 servers per minute.

 

What did we determine? Of the 45+ seconds it takes most users to logon or launch an application, GPO processing time is not a major factor.  Time to look elsewhere.

This script is in the Miscellaneous section of the downloads page.

You can always find the most current script by going to http://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/

Thanks

Webster

About Carl Webster

Webster is a Sr. Solutions Architect for Choice Solutions, LLC and specializes in Citrix, Active Directory and Technical Documentation. Webster has been working with Citrix products for many years starting with Multi-User OS/2 in 1990.

View all posts by Carl Webster

No comments yet.

Leave a Reply