How to fix duplicate remote printers in Windows Server

Windows Server

Questo articolo è disponibile anche in lingua italiana al seguente link: Risolvere il problema delle stampanti duplicate in Windows Server – WindowServer.it

Nowadays, application remoting, as well as desktop, is one of the most used practices by companies that want to consolidate the provision of scenarios in a centralized, uniform and secure way. The last two years have been a big accelerator, as users were sometimes forced to work from home but not everyone was equipped with a notebook and so companies found themselves having to ask employees to use their computers.

Clearly the VDI, or the RemoteApp, allows you to maintain a high security bubble even with respect to a home or public network, rather than a classic unprotected computer.

From this point of view, Parallels Remote Application Server is certainly one of the best solutions, which allows you to manage applications, VDI pools, remote PCs, folders, files and much more so that your users can work on them from any type of device.

Anyone who has used the Windows Server Remote Desktop Services service knows that using the classic MS Remote Desktop Printer driver, generates a printer each remote session as many as those installed on the connection PC for the number of users who connect to the remote machine.

Parallels RAS eliminates this problem, because it allows you to bring only the default printer or a set of printers defined by the administrator; furthermore, unlike the MS driver, printers are only exposed to the single user.

So, given that Virtual Desktop Infrastructure is a beautiful thing, what happens when, due to a problem, remote printers suddenly duplicate and become exponential?

There is a condition in Windows Server that, if remote sessions are not closed properly, prevents the internal printer management service from freeing objects and growing them exponentially on each connection. This thing, in addition to being a problem for the end user, is also a general slowdown in the login phase.

The solution to the problem is to clean the registry and to do this you need to use PSExec, downloadable from the Microsoft site, and do it by launching a PowerShell console such as SYSTEM – Psexec.exe -I -s powershell.exe

Next you will need to execute the following commands:

  • Remove-Item -Path “HKLM:\SYSTEM\CurrentControlSet\Enum\SWD\PRINTENUM*” -Recurse
  • Remove-Item -Path “HKLM:\SYSTEM\CurrentControlSet\Control\DeviceClasses*” -Recurse
  • Remove-Item -Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider*” -Recurse

Another recommended operation is to set a registry key to remove printers at the session LogOff. This can be set via GPO (per Computer) and applied to your Session Hosts.

At the end you can restart your computer and check that everything is back in place.

I found this issue in Windows Server 2019 after an issue generated from Shell Deadlock, where the session hosts were freeze and so the user sessions were not able to be closed correctly.

Another important tips is to set this fix during the night or when the users are not connected.

#DBS