Invalid Printers in RDP Session

1 minute read

Affects:

  • Windows Server 2008
  • Windows Server 2008 R2

Reproducible with Terminal Services or XenApp 6.0. (Other versions using either of the server OS‘s listed above may be affected)

When a user logs in, it creates a registry entry for printers and printers of other users. The issue is that those printers in the registry are not always removed when the user logs out.

Scenario:

  1. User A logs into a XenApp session
The printers belonging to User A are auto-created, and placed in the registry under <a class="zem_slink" title="Windows Registry" href="http://en.wikipedia.org/wiki/Windows_Registry" target="_blank" rel="wikipedia">HKCU</a>Software<a class="zem_slink" title="Microsoft" href="http://www.forbes.com/companies/microsoft/" target="_blank" rel="forbes">Microsoft</a><a class="zem_slink" title="Windows" href="http://www.microsoft.com/WINDOWS" target="_blank" rel="homepage">Windows</a> NTCurrentVersionDevices.   2. User B logs into a XenApp session

The printers belonging to User B are auto-created, and placed in the registry under HKCUSoftwareMicrosoftWindows NTCurrentVersionDevices. The keys for these printers are added to HKCU for ALL active users/sessions.   3. This means that the User A printers are in HKCU for User A, but the User B printers are in HKCU for BOTH User A & User B.   4. If User A logs off at this point, the User B printers that exist in HKCU for User A remain because User B has not yet logged off. These printers persist in HKCU for User A from that <a class="zem_slink" title="Point forward" href="http://en.wikipedia.org/wiki/Point_forward" target="_blank" rel="wikipedia">point forward</a> until they are manually removed.
Solution:
Install the patch on your Terminal Services server from http://support.microsoft.com/kb/2620656.
It is recommended to delete profiles and have them recreated in order to clean them up after patch is installed.
Background:
In our scenario, we run a homegrown application that is mostly built on VB6. When used with XenApp 6.0 on Windows Server 2008 R2, we utilize a printer enumeration function built into VB6 that would populate the list of all printers from the registry key listed above. This means over time printing would get slower and slower.