BACKGROUND :
Often times in Citrix or Terminal Services environments, the autogenerated printer names are too long for certain applications. For example, the Hach WIMS Graph Pac can only support 32 character printer names (See KB Q10186).
For example "HP Laserjet 2100 TN on CITRIXSERVERA (from LT037) on session 21" printer name is way too long for an application that only supports 32 character long printer names.
FIX :
You'll have to create a script that uses Windows Management Interface to shorten the autogenerated printer names.
This script will then need to be added into scheduled tasks in Windows, and setup to run with Administrator priviledges once every minute.
Create a similar script to suit your need:
Use Notepad and create a file with a .vbs extenstion (i.e. RenamePrinters.vbs) and paste the following code:
on error Resume Next
lngMaxCharsAllowed = 32
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)
For Each objItem in colItems
if len(objItem.Name) > lngMaxCharsAllowed then
objItem.RenamePrinter(left(objItem.Name, lngMaxCharsAllowed))
end if
Next
You can test the script file by simply double clicking on the file (i.e. the RenamePrinters.vbs file).
It is expected that you understand the general theories of Windows Scripting and the use of WMI Moniker.
For more information, follow this article's links.