Troubleshooting Citrix ICA Printer Autocreation

Summary

This document describes steps for troubleshooting printer autocreation issues with locally defined, physically attached, or network printers.

Procedure

To troubleshoot printer autocreation, follow these steps:

1. In Citrix Connection Configuration, double-click the ICA listener port, select the Client Settings button, and ensure Connect client printers at logon is selected. For Presentation Server 4.5 and later, configure these settings using the Terminal Services Configuration tool.

2. Ensure that the following check boxes are not selected under the Client Settings area:

• Disable Windows Client Printer Mapping

• Disable Client LPT Mapping

Both of these settings prevent client printers from being autocreated on the system, and prohibit the client printer from being manually added during the session.

3. If Inherent User Config is selected in step 1, ensure that connect client printers at logon is selected in the UserConfig button for each user account within User Manager for Domains or the Environment tab within Active Directory Users and Computers/Computer Management-Local Users and Groups (for Active Directory 2000, 2003).

In Active Directory 2008, open the Server Manager utility and expand the Configuration node. From there you can manage your users and groups.

4. From the client machine:

a. Make a custom ICA connection directly to the server desktop and log on.

b. Open the printer folder inside the ICA session.

c. Add Printer > Network printer and expand Client network.

d. Select Client printer and try to Add.

e. The result may indicate:

• A suitable driver must be added.

• Access is denied (permissions issue).

• The printer is not seen under the client network (the printer must be defined in the local client print folder).

• If you cannot expand a Microsoft server with a shared printer (possibly an operating system/RPC issue).

• The “Could not connect to the printer” error message is received. Refer to CTX102808 – Error: Could not connect to the printer.

• The client network cannot be seen. Refer to CTX748796 – Users Unable to see the Client Network when in Print Manger or Connect to Printer.

5. Current Microsoft RDP clients allow for the creation of printers. While the RDP does not use the Citrix Client Network Service, as a test, log on with the RDP client. This might help in determining if there is an underlying operating system or permission issue.

6. Ensure the latest compatible driver for its operating system is installed on the client computer. On the Citrix server, install the latest compatible driver for the base operating system (Windows 2000 Server, Windows Server 2003, or Windows Server 2008). This is accomplished by installing a “phantom” printer on the server console. After the printer has been created it can be deleted from the print manager. The driver itself and registry references to the driver remain. You must verify what drivers have been installed on the server in step 7 below. In Windows 2000 Server, Windows Server 2003, and Windows Server 2008, right-click in the white space in the Printers folder, go to Server Properties, and select the Drivers tab.

A printer driver that is compatible with Windows 2000/2003/2008 is not necessarily compatible with the corresponding version of Terminal Server. Installing incompatible drivers might cause crashes (for example, see Microsoft TechNet articlesQ191666 and Q249917 with respect to Lexmark drivers), spooler CPU spikes, hangs, print jobs failing to print, and autocreated printers might fail to delete upon log off (one possible cause of this is the lack of an Autocreated Printer definition inside the printer properties comment field).

Issues of this type should follow the recommendation in TechNet article Q135406 to remove the suspect driver from the system and to use the management console (which is known as the Advanced Configuration utility in XenApp and the Presentation Server Console in Presentation Server) to configure exclusions, manual print driver mappings, or to exclusively use the UPD. Syntax, spacing, and capitalization between the quotes within the manual mapping process are critical. A substituted print driver might limit the available printer functionality inside an ICA session with respect to the non-native driver.

For details concerning manual mappings and the wtsuprn.inf file usage, see CTX626451 – Sample WTSUPRN.INF File for Use in Autocreation of Client Printers.

7. Verify which drivers have been installed on your Citrix server by checking the following registry keys:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-1 (WinFrame, NT 3.51)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-2 (NT 4.0)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3 (Windows 2000 Server, or Windows Server 2003/2008)

Note: For 64-bit drivers, check the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x64\Drivers\… key.

Also, the existence of the driver does not guarantee this process will work. The driver might be corrupted. If this is the case, complete the following procedure:

a. Remove the driver.

b. Restart the print services.

c. Add the driver again.

8. Verify that administrators can autocreate client printers. If administrators can autocreate 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

Note: Autocreation of 32-bit client printers involves both the client and the server.

ICA Client printer autocreation happens during the logon process.

In MetaFrame for Terminal Server Edition, ctxlogon is called directly by winlogon.

In XenApp 5.0 and Presentation Server for Windows 2000 Server and Windows Server 2003, ctxnotif.dll replaces Ctxlogon.exe and Ctxlogof.exe. Winlogon, specifically cmstart.exe, calls ctxnotif.dll, which makes a function call to ctxlogon to create printer connections. It handles logon/logoff notifications for specific logon processing (for example, creating printer connections).

9. For MetaFrame 1.x on NT 4.0 Terminal Server Edition, ensure users have read (RX) rights to ctxlogon.exe and ctxlogoff.exe. By default, the Everyone group is configured for read permission during the installation of MetaFrame.

10. For Terminal Server 4.0 installations check to see if the following registry entry exists:

HKEY_LOCAL_Machine/Software/Microsoft/WindowsNT/CurrentVersion/Winlogon
Key Name: Userinit
Value: CTXLOGON.EXE

For Windows 2000 Server and Windows Server 2003/2008 Terminal Server installations, check to see if the following registry entry exists:

HKEY_LOCAL_Machine/Software/Microsoft/WindowsNT/CurrentVersion/Winlogon
Key Name: AppSetup
Value: Cmstart.EXE

Note: Cmstart.exe is needed to ensure wfshell is running in a session. See CTX102634 – WFSHELL.exe crashes when attempting to autocreate certain HP Print Drivers.

11. Since MetaFrame XP Service Pack 2/Feature Release 2, the behavior in which client side network printers are autocreated has changed. MetaFrame XP Service Pack 3/Feature Release 3 and later contains a check box in the Management Console, under Printer Node Properties, to toggle this behavior. For MetaFrame XP Service Pack 2/Feature Release 2, see if CTX101829 – Hotfix XE102W065 – For MetaFrame XP 1.0 for Windows 2000 Server – English and the corresponding registry change resolve the issue.

The hotfix introduces a registry switch so that you can toggle which functionality you want — direct connection to network printers from a Feature Release 2 server or the network printers created as client printers that print through the ICA client device.

Navigate to the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\ClientPrinterAutoCreate

Value Name: fCreateNetworkPrinter
Value Type: DWORD
Value: 1 (to have network printers created as client printers)
Value: 0 (to retain the Feature Release 2 behavior)

With this feature enabled, network printers are created as client printers in the ICA session.

For Presentation Server 3.0 and later, create a new policy and expand Printing > Client printersprint job routing. Enable it to select one of the following choices: Connect directly to network print server if possible or Always connect the printer indirectly as a client printer

12. See if any Citrix policies to disable printing have been set in the Management Console.

13. See if any Printer Compatibility Mappings or Driver Restrictions in the Citrix Management Console apply.

14. For MetaFrame XP Service Pack 3/Feature Release 3 on Windows 2003, verify that the Feature Release 3 licenses have been obtained from My Citrix, and they have been installed and activated.

From Hotfix XE103W2K3006:

In Windows Server 2003, client printers could not be autocreated without installing a Citrix Feature Release 3 license.

Terminal services in Windows Server 2003 were changed so that the printer virtual channel needed to be created in the system context. The MetaFrame server would not issue a printer autocreation command through the printer virtual channel.

This hotfix ensures that the printer virtual channel is created in the system context and a Feature Release 3 license is no longer required.

[#63348]

15. See if the following article applies:

CTX102580 – How to Disable Printing Through NFuse/Web Interface

16. Citrix bases its autocreation of printers on client name and printer driver name, so it is recommended that each client has a unique name. See CTX376489 – Clientnames Should Always Be Unique.

The algorithm used to create the printer name might cause an issue with some applications. The issue is often the length of the name. This issue can be reproduced outside of a Citrix environment by creating the equivalent name length for a Microsoft shared printer. The application might need to be changed with respect to the way it enumerates and uses printer APIs. See Microsoft TechNet article Q240082.

17. Hewlett-Packard has introduced a new architecture targeted for the home market called Print Performance Architecture (PPA). Microsoft is not supporting the PPA architecture on all of its operating systems; therefore PPA is not supported in a Citrix environment. Refer to the following:

• Microsoft article Q153958

• CTX110571 – HP Printers Supported in XenApp Environments

18. After verifying all of the above, if your printer still does not autocreate, confirm that the driver names are identical on the client and the server. Sometimes driver names differ marginally from one operating system to another. In such an instance, you need to map the names correctly using the Driver Mapping tool within the management console (in Presentation Server and XenApp).

In MetaFrame 1.8, you must map the names correctly in the Ctxuprn.inf and Wtsuprn.inf files (these files reside in the %SystemRoot%\System32 folder). For the wtsuprn.inf file usage information and a sample file, reference CTX626451 – Sample WTSUPRN.INF File for Use in Autocreation of Client Printers.

Note: This is not supported in Presentation Server or XenApp.

In MetaFrame XP, you can use the Citrix Management Console or the QPrinter.exe command.

Printing Algorithm

The printing algorithm checks in this order:

1. <client name>#<printer name> in wtsuprn.inf

2. <printer name> in wtsuprn.inf

3. <client name>#<printer name> in wtsprnt.inf

4. <printer name> in wtsprnt.inf

5. <client name>#<client printer driver name> in wtsuprn.inf

6. <client printer driver name> in wtsuprn.inf

7. <client name>#<client printer driver name> in wtsprnt.inf

8. <client printer driver name> in wtsprnt.inf

9. <client printer driver name> in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-2 and \Version-3

10. <client printer driver name> in ntprint.inf. If a match is found, the new name is substituted for the driver name when the printer creation is attempted.

The client printer mechanism checks the registry first. If the driver has been installed, the registry entry exists and the printer creates without a problem. If the registry entry does not exist for that particular driver, it looks in the ntprint.inf file to determine if the driver is available from the base server installation. If it is a known driver and the installation is available (through a CD or the network), the driver is silently installed on the machine and the printer creation goes forward.

11. When the UPD is selected, much depends on how the Printer Management settings are configured in the management console. With the default setting it creates the UPD after first attempting to create the printer using the native driver, following the above algorithm. This also occurs when using the management console to exclude drivers.

For additional information, see CTX114079 – Breakdown of the Print Driver Mapping Process and CTX089874 – Troubleshooting and Explaining the Citrix Universal Print Driver.

Process Overview

The process begins on the client side. The wfica32 calls the APIs locally to enumerate client printers and send the information to the server. These client printers might be defined locally on the client port or they can be network printers defined locally. The printer mapping file (wtsuprn.inf) is referenced to determine which driver is used to autocreate the printer. The driver is then installed on the server if it is available to the operating system through the ntprint.inf file.

Timing

The timing of the printer autocreation depends on whether the user is connecting to a published application or directly to a server desktop.

If the user is connecting to a published application, the printer autocreation process is synchronous so that the application finds a default printer when it is executed. This is by design because some applications do not load if a default printer is not defined.

If the user is connecting to a server desktop, the printer is created asynchronously to increase logon speed.

The synchronous process can be enabled in MetaFrame XP and later within the individual application properties by clicking Client Options. Under the Printing section, select the Start this application without waiting for printers to be createdcheck box.