Phantom printers on Windows

network-printerprinterwindows-server-2012-r2

I have a few Windows 2012 R2 servers that all show 300 – 400 printers in Control Panel > Hardware > Devices and Printers. They also show up as print queues in Device Manager. Many of them are duplicates – the list in Devices and Printers looks something like this:

Printer_A on Print_Server_1
Printer_A on Print_Server_1
Printer_A on Print_Server_1
Printer_A on Print_Server_1
Printer_A on Print_Server_1
Printer_B on Print_Server_1
Printer_B on Print_Server_1
Printer_X on Print_Server_2
Printer_X on Print_Server_2
Printer_X on Print_Server_2
Printer_X on Print_Server_2

I can remove the printers in Devices and Printers by selecting a printer and clicking "Remove device". The printers seem to be removed, but show up again after I logout and log back in.

When I run this I see an empty list (0 printers):

c:\windows\system32\rundll32.exe printui.dll,PrintUIEntry /ge

The PowerShell cmdlet get-printer lists just five printers, as does this:

cscript c:\windows\system32\printing_admin_scripts\en-us\prnmngr.vbs -l

I see the same five printers under this key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers

I see 23 connections (none are duplicates) under this key:

HKEY_CURRENT_USER\Printers\Connections

How can I figure out where these hundreds of printers are coming from so that I can permanently remove them? The servers are brokered in RDS – could they be getting these printers from each other somehow?

Best Answer

Apparently this is an issue with Windows Server if the server has the RDS role AND is using a remote print server where client-side rendering is enabled.

An easy fix is to add registry entries to enable 15-minute trimming of the printer list, and automatic removal at logout:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider]
"InactiveGuidPrinterAge"=dword:00000384
"ActiveGuidPrinterAge"=dword:00000384
"InactiveGuidPrinterTrim"=dword:00000384
"RemovePrintersAtLogoff"=dword:00000001

After adding the above entries, bump the print spooler service and the automatic periodic trimming of printers will begin.