Summary
This article describes how to print from legacy applications using the Net Use command with LPT ports. Legacy applications, such as DOS-based ones, do not interact directly with the spooler. Instead of printing to a printer, they print to a port such as LPT1 or LPT2. The flow control depends on what other software is using that port.
• If the target port is managed by a network redirector, (the user has issued a Net Use <portname> \\<server>\<share> command), the job goes to the appropriate redirector (the Windows network redirector or the NetWare network redirector). The Windows spooler is not involved, so the job is neither spooled nor modified.
• If the redirector isn’t involved and a local printer defined in Print Manager or the Printers folder prints to the target port, the job goes to that local printer and is assigned that printer’s default data type.
• If neither the redirector nor a printer is involved, the job goes to the parallel or serial driver that controls the target port and the print device receives the job. The Windows spooler is not involved, so the job is neither spooled nor modified.
When printing from DOS-based applications that do not use the Windows spool queue, ensure the NET USE command is executed before printing.
Only one device may be mapped to an LPT port.
General Information for an ICA Session
Unlike COM Port redirection, which is bi-directional, LPT mapping is output only and limited to \\client\LPT1 and \\client\LPT2 within an ICA session. See Knowledge Center article CTX384590 – Troubleshooting COM Port Redirection Issues for more information.
By default, the ICA connection maps LPT1 and LPT2. This default behavior is viewable using a desktop or published command prompt, cmd.exe, and typing NET USE. The output should be as follows:
C:\Documents and Settings\username>net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
A: \\Client\A$ Client Network
LPT1 \\Client\LPT1: Client Network
LPT2 \\Client\LPT2: Client Network
U: \\Client\D$ Client Network
V: \\Client\C$ Client Network
The command completed successfully.
Note: Server LPT3 cannot be mapped to \\client\LPT3 but can be mapped to \\client\LPT2:
C:\Documents and Settings\username>net use lpt3 \\client\lpt3
System error 55 has occurred.
The specified network resource or device is no longer available.
C:\Documents and Settings\username>net use lpt3 \\client\lpt2
The command completed successfully.
C:\Documents and Settings\username>net use
New connections will be remembered.
Status Local Remote Network
------------------------------------------------------------------------------
A: \\Client\A$ Client Network
LPT1 \\Client\LPT1: Client Network
LPT2 \\Client\LPT2: Client Network
LPT3 \\Client\LPT2: Client Network
U: \\Client\D$ Client Network
V: \\Client\C$ Client Network
The command completed successfully.
In addition, the following may be attempted:
Within the ICA session (Only valid for Terminal Server 4.0), at the command prompt, type QOBJECT /DEVICE > QOBJECT.TXT. The output contains the mapping for LPT1 and LPT2.
For example:
LPT1 \Device\CdmRedirector\LPT1:\13\LPT1:
LPT2 \Device\CdmRedirector\LPT2:\13\LPT2:
LPT3 \Device\CdmRedirector\LPT3:\13\LPT2:
In the mapping for the client device, LPTx:\yy\LPTz: LPTx is the port name at the server side, /yy/ is the session ID, and LPTz is the port on the client site where LPTx is pointing to. The port has been mapped using the CDM redirector. This is the Citrix redirector for mapping client devices.
If the output shows the LanMan redirector, it indicates that the port on the server is being mapped to another port on the server network (using Microsoft networking).
Printing to an LPT Port inside an ICA session
If the ICA Client workstation has a printer physically attached to it or a network printer mapped to an LPT port (run the NET USE command on the local workstation), the following command line should print out a listing of the current directory.
C:\Documents and Settings\username>DIR > LPTx:(where x is the port #)
Test this at the local workstation and inside the session.
If the ICA Client workstation has a printer physically attached to it or a network printer mapped to a LPT port (run the NET USE command on the local workstation) and the printer is not defined in the workstation’s printer folder, the application will not be able to print to the client printer inside an ICA session.
The LPT port redirection in the Windows client uses strictly StartDocPrinter(), WritePrinter(), and EndDocPrinter() APIs meaning it must have a local Windows printer to target.
Disabling LPT Port mapping for an ICA session
The disabling of ICA LPT mapping would allow for the mapping of a network printer to an LPT port inside an ICA session.
NET USE LPTx: \\servername\printershare
Note: The Citrix Redirector, CDM, is not being used in this scenario. Any issues discovered inside an ICA session would most likely be reproducible inside a RDP session. You would need to contact the appropriate redirector, Microsoft, Novell, and so on.
LPT disabling may be done at the Windows 2003 policy level, the ICA listener level, or through Citrix Management Console Policies. See the following screen shots:


More Information
CTX104693 – �Client Printer mapping� and �Client LPT Port mapping� are greyed out in ica-tcp listener
CTX116884 – Domain Users Cannot Map LPT Ports to a Network Printer
CTX075409 – How to Create a DOS Client or Winterm Printer for All Users
CTX881017 - Troubleshooting MetaFrame XP Imported Network Print Servers