Sunday, April 26, 2009

Terminal Server / Citrix Printing Errors

Terminal Servers and Citrix can be very picky when it comes to printers. BSOD, print spooler crash, auto-created printers fail, etc. The list of side effects of a bad print driver can be overwhelming.

Something that should be noted right away. These issues are not necessarily due to bad programing from Citrix or TS. These problems are the direct result of sloppy drivers written by the manufacturers (HP, Sharp, etc). To fully fix the issue the printer manufacturers need to step up and write true multisession drivers. That said...

The normal issue that is experienced with Citrix/Terminal Services and print drivers is that a driver is not true multisession aware or an application it calls upon isn't multisession aware. This can cause a number of issues the most common I’ve seen to be that the print spooler stops responding and crashes. Simply restarting the print spooler and citrix print management service fixes this until the next error. The errors can start by users logging in, printing, etc.

How to fix….
create a batch file to automatically restart the services for you when it crashes
This will give you some breathing room to actually work on the issue rather than just putting out fires.

net stop "Citrix Print Manager Service"
net stop "Print Spooler"
net start "Print Spooler"
net start "Citrix Print Manager Service"
SET logfile=C:\AdminTools\SpoolerCrashLogs.log
ECHO Print spooler crashed on %date% at %time% on %computername% >> %Logfile%

This will stop each service and then restart in the correct order. It then looks for the logfile and will log that it did this. This gives you a visual representation so that they can actually see how bad the problem is (longer the file, worse the problem).
Go into Services and set the print spooler service Recovery tab so that first, second, subsequent failures to run a program. Set the path of the program to run to the location of the batch file created.
To test you can open the task manager and end task on the spoolsv.exe then check the logfile. It should have logged it if it’s working and the print spooler and citrix print manager service should have restarted.

Next we need to find the drivers that are causing the problem.
If it produces a failure then you have your bad driver. Certain errors can be ignored (see bottom of above link page for details on running and errors).

Run it for each driver with different criteria (ie test it creating 1 printer, then 5, then 10) I tested up to 40 printer creation. If it could pass that then it’s good. Note this tool can also be used to find which types of drivers perform best (PCL5 vs PCL6 vs PS). Also test multiple drivers simultaneously (HP 4050 and 4350 at same time).
Make list of all drivers that don’t pass.

Create new list of printers and map to only drivers that passed the test (for instance if a 4100 series driver passed but a 4200 series didn’t then map the 4200 printer to the 4100 driver).
  • Use the MS spooler cleaner utility (ensure all users are logged off the Citrix server). http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en (it’s the cleanspl.exe tool).
  • If using a network print server… you have to start there which likely isn’t a small job. In my environment I rebuilt printing from the ground up. (long term has saved me countless hours though). NOTE if you run this tool you can’t undo! Make sure you are ready to rebuild the servers print drivers/printers list including all ports, etc. Make very sure you have a list of all printer share names and driver mappings etc.
  • When you run it, it asks you if you want to remove some things that are actually delivered (and installed by default) with Windows. In most cases, you should answer No to the corresponding prompts (you don't want to remove the Standard TCP/IP Port or the BJ Language Monitor). http://members.shaw.ca/bsanders/CleanPrinterDrivers.htm
  • After cleaning print server and Citrix servers spoolers reinstall only the good drivers and map printers to correct drivers.
  • Test all drivers prior to installing / purchasing new printers. Make a list of good drivers and only allow them, make no exceptions.
  • Don’t trust manufacturer’s “supported” lists. I know for a fact that the HP list and Sharp list both contain drivers that they state they “tested” and support in Citrix and I have verified that they cause various issues in Citrix from spooler crash to high RAM usage or CPU usage.
  • Use as few drivers as possible.
  • Use only Windows Native drivers if possible. (drivers from the windows installation disk)
  • Ensure that all print processors are “winprint”. Disabling Advanced properties also helps with speed.
  • Absolute must!!! Create policy in Citrix and AD Group Policy
    Citrix Printing – Drivers – Native printer driver auto-install
    i. Enabled
    ii. Do not automatically install drivers
    Citrix Printing – Drivers – Universal driver
    i. Enabled
    ii. Use universal driver only if requsted driver is unavailable
    Active Directory Group Policy create template
    i. Create and attach custom adm to group policy and enable it. This prevents mapping of print drivers though RDP sessions (ie Administrator logons to Citrix/TS servers via RDP). Enable it with Loopback policy so that it only applys to your Terminal Servers (or other servers if wanted as well).
CLASS MACHINE
CATEGORY "Custom RDP Printer Redirection"
POLICY "RDP Printer Redirection"
EXPLAIN "When enabled this policy stops mapping of printers from client workstation through RDP sessions - This does not effect ICA connections - The Default GP rule effects both ICA and RDP - Purpose is to prevent Admin RDP sessions from installing drivers. Set to Enabled to Disable Mapping"
KEYNAME "System\CurrentControlSet\Control\Terminal Server\Winstations\RDP-Tcp"
VALUENAME "fDisableCpm"
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
END
POLICY
END CATEGORY

Some other good reading… http://forums.citrix.com/thread.jspa?forumID=86&threadID=67060&messageID=581242

The absolute best solution though… Throw away all printers.



Note: see my post HP Print Monitor Errors / RAM and CPU Utilization regarding how to "fix" some HP drivers so that they work in TS / Citrix environments with less problems.

6 comments:

  1. i had exactly the same problem but i have found one commercial solutions at www.terminalworks.com

    ReplyDelete
  2. Thanks for adding in what you use Steve.

    Another that works very well is Screwdrivers. http://www.tricerat.com/products/screwdrivers


    Also, If your running XenApp 6.5 or XenDesktop 5.5 keep an eye out for the new Citrix Universal Print Server! http://blogs.citrix.com/2011/11/17/project-phaser-universal-print-server-tech-preview-released/

    ReplyDelete
  3. yes but Screwdrivers from tricerat is too expensive, http://terminalworks.com/ offers low prices and great quality. there is a TRIA, so you can try, hope it helps

    ReplyDelete
  4. Steve, I had missed the section where they cover pricing... excellent pricing!

    When I get a few minutes I'll download the trial and test it out. Thanks!

    ReplyDelete
  5. I looked closer at terminalworks.com and it appears to be an excellent solution depending on the clients needed to support.

    Since it is a 2 part install (one on server and one on client) this won't work in environments where non-windows embedded thin clients are in use (ie Windows CE).

    I personally agree with the Central Print server client install <-> terminal server client model solutions. This allows a full solution to be implemented without ever touching the end client devices. And in most solutions I've seen now also allows for easy branch office solution implementation.

    ThinPrint offers a concurrent user licensing model so it can be very affordable depending on user counts. It also offers many valuable features (although I admit it's not my favorite solution I've seen)

    Tricerat unfortunately doesn't offer a user licensing model yet and is still per server, this equals a hefty pricetag. Per server pricing in my opinion just doesn't make sense anymore.
    Per user licensing allows the admin to determine if they prefer lots of light loaded servers or less highly loaded servers. Per server pushes towards few high loaded servers and makes it harder to expand without big $$.

    ReplyDelete