PROBLEM: COM port redirection is not fully functional via ICA connection. The COM port redirection was occurring (determined by running a net use cmd within the Citrix session) and print was being sent to the printer, but the output on the printer was gibberish – symbols, etc.  In troubleshooting the issue, it was discovered that the COM port redirection was completely functional via an RDP session, and the COM port redirection was fully functional within an ICA session once an RDP session was initiated and information was sent to the redirected COM device. However, upon reboot of the client device, COM port redirection was no longer fully functional within an ICA session.[more]

CAUSE: According to the KB article, http://support.microsoft.com/kb/112841/en-us, the COM port settings for a device can be stored in two different locations – within the Control Panel and within the Command Prompt interface.  The settings used by the device will depend on how the application communicates with the port – via the Control Panel\registry or directly with the COM port via the command interface.  The settings are not dependent on each other and can be changed independently of one another.  COM port redirection via ICA and RDP use the settings set within the port itself.  To add to the complexity, it appears that the RDP protocol automatically sets the client device port settings when a session is initiated to match the settings for the COM port on the host server.  This was the reason that the application was working via RDP and any subsequent ICA session.

MODE.COM queries the port directly.  Default settings (Windows XP, 7E) are the following (MODE.COM did not seem to be available within XPe):

Status for Device COM1:

  • Baud: 1200
  • Parity: Even
  • Data Bits: 7
  • Stop Bits: 1
  • Timeout: OFF
  • XON/XOFF: OFF
  • CTS handshaking: OFF
  • DSR handshaking: OFF
  • DSR sensitivity: OFF
  • DTR circuit: ON
  • RTS circuit: ON

Applications reset the mode of the COM port(s).  If, for example, you start Terminal and reset COM1 to 14400 baud, 7 data bits, odd parity, then exit Terminal, the new settings remain in effect until the computer is shut down.  Upon rebooting, the default settings are once again in effect.  The Control Panel settings, on the other hand, affect the registry.  An application that is appropriately written can query the registry for these values and use the Control Panel settings.  The default settings in the Ports option of Control Panel\Device Manager are:

Settings for COM1:

  • Baud Rate: 9600
  • Data Bits: 8
  • Parity: None
  • Stop Bits: 1
  • Flow Control: None   

SOLUTION: You can manually set the COM port settings by using this command: “Mode COM1: 9600,n,8,1”. However, when you restart the system, you will find the settings revert back to the default. To resolve the issue, create a startup task or place a batch file in startup that sets the COM port to the required settings. 

Example: C:\windows\system32\mode.com com1: 9600,n,8,1