Troubleshooting Process for Printing Issues with Auto-creation Failure and Citrix Print Manager Crashing

Troubleshooting Process for Printing Issues with Auto-creation Failure and Citrix Print Manager Crashing

book

Article ID: CTX132102

calendar_today

Updated On:

Description

This article contains information about the troubleshooting process for printing issues with auto-creation failure and Citrix Print Manager crashing.

Background

The following information was collected from consistent use of the same procedure to troubleshoot multiple printing issues with auto-created printers and the Citrix Print Manager service crashing.

Environment

Caution! Using Registry Editor incorrectly can cause serious problems that might require you to reinstall your operating system. Citrix cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. Be sure to back up the registry before you edit it.

Resolution

Troubleshooting Process

Non-native print drivers are the main cause for the failure of auto-creation causing a slew of other issues that must be considered after identifying the drivers to remove from the server.

To troubleshoot the issue, complete the following steps:

  1. Ensure that you have all the available hotfixes for your environment:

  1. Ensure that you apply the auto-creation policy to the appropriate group of users. You can check this by browsing to the following policy registry hive:
    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Citrix\(session#)\PrintingPoliciesHKEY_LOCAL_MACHINE\SOFTWARE\Policies\Citrix\(session#)\PrintingPolicies

  1. If you do not see the policies applied to the user, verify if the policy is applied to the correct user group. If the policy is still not applying, complete the following tasks:

  1. Open the C:\ProgramData\Citrix\Group Policy folder and delete all items in the Group Policy folder. Open a Command window and run the gpupdate /force command to add contents to the folder with the new Group Policy information from Active Directory and Citrix.

  2. Open the HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Citrix folder, and remove all hives with a session number. This is a dynamic key and does not affect any existing sessions on the server. This ensures that all new sessions receive the new group policies on the server.

  3. Restart the Citrix Group Policy Engine service, and you will now notice that new sessions populate the registry hive with the correct policies applied.

  1. Ensure that the non-native print drivers are not causing issues on the server. The best way to identify non-native print drivers is to observe the registry.

    Consider a 64-bit computer as an example: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Drivers\Version-3\

    Note: Check for a version number in MinInboxDriverVerVersion. If this version is 6.x, then it is a native driver. If it reads 0.0.0.0, then it is a non-native driver. For more information, refer to the Knowledge Center article CTX126093– How to Distinguish Native/Inbox Print Drivers from Non-native/Manufacturer Print Drivers in Windows Server 2008 R2

    At this point use the Citrix Print Driver Stress Test tool to see if this driver is causing the issues. For more information, refer to the Knowledge Center article CTX109374 – StressPrinters 1.3.2 for 32-bit and 64-bit Platforms. HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Citrix\(session#)\PrintingPolicies

  1. After you have tested the drivers and found the drivers that failed to pass the stress test in the normal amount of time in a 5x5 test, (that is an average of 12 to 30 seconds), then you should remove these drivers from the server.
    In the following example of the 5x5 setup for testing, 5 concurrent AddPrinter() events are created and repeats it 5 times:
    image from the stress test tool
    (image from the stress test tool)
    After you remove the drivers from the server, you should check what contents are left behind from the bad drivers. Drivers must respond to the AddPrinter(), XcvData(), and DeletePrinter() API function calls. If the driver does not respond in time, it begins to leave orphaned printers in the registry in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers hive, eventually causing a traffic jam. This might cause the Citrix Print Manager service to crash, not be able to restart, or even to stop functioning.
    Note: Sometimes print drivers can be problematic to remove from servers since they are loaded once the spooler is running. Using the following method is the easiest way to remove a problematic print driver:
    Caution! Refer to the Disclaimer at the end of this article before using Registry Editor.

  1. Stop the print spooler and Ctx_CpSvc services.

  2. Open HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\.

  3. Rename all Print Processors that are listed: eg Winprint to Winprint.old, Hpzppw71 to Hpzpp71.old, and so on.

  4. Start the print spooler.

  5. In a command prompt, run printui /s (This opens the print server properties). Click on the driver tab and remove the problematic driver.

  6. Open HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\.

  7. Rename all the Print Processors back from Winprint.old to Winprint, Hpzpp71.old to Hpzpp71, and so on.

  8. Restart print spooler and Ctx_CpSvc services.

  1. Caution! Refer to the Disclaimer at the end of this article before using Registry Editor.
    Print drivers that do not respond to the DeletePrinter() API correctly will leave stale records in the registry, these records can build up if the driver is not removed causing printing problems in your XenApp environment.
    The registry Hive is: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers.You should remove anything in this hive that has a comma after the session number along with another arbitrarily generated number. You should ensure that the printing values you remove do not currently have sessions logged onto the server. If it does, then it can cause problems to the user session.
    Do not remove any of the local printers on the server. Remove only the printers created with session numbers and commas after them, or any other irregularities. These irregular printers are created when the print driver does not respond to the DeletePrinter() API function call.
    DeletePrinter() API function

  2. After the drivers and the registry are cleaned out, you should clean out the underlying foundation of the XenApp environment, the Datastore. Open the Command window with administrator credentials. Run the dscheck /full printers /<switches> to purge printer data. Refer to article, CTX124406 – DSCHECK - XenApp Data Store Checker Tool Commands.
    Note: DSCHECK applies only to XenApp versions 6.5 and earlier.

  3. If you are replicating printers, do not run the /purge_replications. Although this will not remove the actual driver replication from the servers, it deletes all the replication information stored in the datastore. After you have run all the purge commands and the datastore is clean, recreate the Local Host Cache on all the servers.

  • From the Command prompt run the “net stop imaservice” command to stop the IMA service.

  • Run the “dsmaint recreatelhc” command to recreate the Local Host Cache.

  • Run the net start imaservice command to start the IMA service.

  1. Caution! Refer to the Disclaimer at the end of this article before using Registry Editor.
    If you still experience a printing issue, we will need to clear any entries under the Current Users registry key. Open a command line interface and type the following information exactly as written, including the quotation marks:
    Reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices" /va /f
    Reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts" /va /f

    Note: This does not remove the Devices and PrinterPorts keys, it only removes the information from within those keys.

  2. Verify that administrators can auto-create client printers. If administrators can auto-create and regular users cannot, confirm that users have at least Read, Write, and Execute permissions to the following files and directories:

    %SystemRoot%\System32\spool
    %SystemRoot%\System32\printer.inf
    Sometimes after everything has been cleaned out, there may be a few entries left behind that may cause some instability with printing, especially if hundreds of entries are found in the following locations:
    HKEY_USERS\.DEFAULT\Printers\DevModePerUser
    HKEY_USERS\.DEFAULT\Printers\DevModes2
    HKEY_USERS\S-1-5-18\Printers\DevModePerUser
    HKEY_USERS\S-1-5-18\Printers\DevModes2
    HKEY_USERS\S-1-5-19\Printers\DevModePerUser
    HKEY_USERS\S-1-5-19\Printers\DevModes2
    HKEY_USERS\S-1-5-20\Printers\DevModePerUser
    HKEY_USERS\S-1-5-20\Printers\DevModes2
    These locations reference accounts for the following:
    DEFAULT = Local System Profile Hive (Copy of Local System hive)
    S-1-5-18 = Local System
    S-1-5-19 = Local Service
    S-1-5-20 = Network Service

    Depending on which service account has been selected to run the print spooler, these will be the accounts to clean out. In this example, the spooler is run under the Local System:
    service account has been selected to run the print spooler
    We can see from the following entries, two printers were auto-created and their entries were placed in the DevModes2 hive for the Local System account and the .Default account. These two accounts are mirrors of each other since the .DEFAULT profile, is the systems profile. If one of these hives has hundreds if not thousands of entries, it will populate both registry hives causing the spooler and the Citrix Print manager to have to query all entries in that hive causing delays and crashes.two printers were auto-created and their entries were placed in the DevModes2 hive for the Local System account and the .Default account

    two printers were auto-created and their entries were placed in the DevModes2 hive for the Local System account and the .Default account

  1. Caution! Refer to the Disclaimer at the end of this article before using Registry Editor.
    To simplify the cleanup of these hives, run the following commands in a command window. Once the commands have been run, restart the print spooler for the new data to be added to those entries.
    Reg delete "HKEY_USERS\.DEFAULT\Printers\DevModes2" /va /f
    Reg delete "HKEY_USERS\.DEFAULT\Printers\DevModePerUser" /va /f
    Reg delete "HKEY_USERS\S-1-5-19\Printers\DevModes2" /va /f
    Reg delete "HKEY_USERS\S-1-5-19\Printers\DevModePerUser" /va /f
    Reg delete "HKEY_USERS\S-1-5-20\Printers\DevModes2" /va /f
    Reg delete "HKEY_USERS\S-1-5-20\Printers\DevModePerUser" /va /f

    Note: This does not remove the DevModes2 and DevModePerUser keys, it only removes the information from within those keys. The S-1-5-18 account does not need to be cleaned out as it is a mirror of the .DEFAULT hive.

  2. Caution! Refer to the Disclaimer at the end of this article before using Registry Editor.
    Other locations that store user print device preference information can also get filled up with data if not purged regularly. This can also cause problems with your spooler and your Citrix Print Manager services. Run the following commands in a command prompt to finalize the cleanup of your server:
    Reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices" /va /f
    Reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts" /va /f
    Reg delete "HKEY_USERS\S-1-5-19\Software\Microsoft\Windows NT\CurrentVersion\Devices" /va /f
    Reg delete "HKEY_USERS\S-1-5-19\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts" /va /f
    Reg delete "HKEY_USERS\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\Devices" /va /f
    Reg delete "HKEY_USERS\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts" /va /f

    Note: This does not remove the Devices and PrinterPorts keys, it only removes the information from within those keys.

Issue/Introduction

This article provides the troubleshooting process for issues related to auto-creation failure and Citrix Print Manager crashing.

Additional Information

CTX104375 – Default Printer is Not Mapped Properly Within an ICA Session
CTX115553 – How to Print Documents From the Advanced Universal Print Driver
CTX117008 – Printer Autocreation Event Log Messages Overview
The following CTX Case Study article is a good reference to use when the CpSvc.exe service is crashing or having issues enumerating printers, after cleaning everything out, if you are still having issues, taking a dump of the CpSvc.exe and spool.exe processes can help narrow down if you have a driver still loaded in memory causing issues.
CTX112580 – Case Study: Intermittent Client Printer Creation and Deletion Failures