Hi,
thank you for your answer. I've cloned / sysprepped today a RDSh and made a separate collection in the way I can try to implement various solutions and avoid mess up with the productive environment.
I've been reading a lot about such issue and how it works Printing for RDS on W2016/2019. I really don't get why Printers connected from Users are stored in HKLM..
I've been dealing with another issue for another customer today, but this environment is using XenApp and Printers are deployed through PS Script and assigned via item-targeting (Groups/Users), it seems that issue got fixed by disabling on all shared printers "Render Print Jobs on Client Computers" and by adding the registry value you also mentioned, after deleting all sub-keys of HKLM/Client Side Rendering Print Provider on XenApp Servers.
After some discussion with another engineering team, it looks like a similar issue of my OP was already "solved" but with a workaround that is not really a solution I would be happy to use. The issue has been identified with the fact the printers connected from users are appearing on control panel -> Printers and devices with such a great delay (minutes, not seconds, and everything is on-prem on a single hyper-v failover cluster - despite they can be seen immediately by printing from Notepad or other programs), causing the Standard Printer to be assigned to the first "physical" printer found (in this case a PDF Printer on RDSH).
Anyway, if I add the value you suggested, I don't risk that all the printers connected from Users will disappear? As I mentioned, we are not using any GPO or PS Script to deploy printers, Users are choosing the printers they need and they must not disappear. We are using FSLogix Profiles so everything except redirected folders is stored in FSLogix Profiles.
This is the workaround suggested from the Engineering team, maybe could inspire new suggestions..
- Logout all Users
- Open registry with psexec -i –s c:\windows\regedit.exe
- Delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider" and then Re-Create it (empty)
- Add under Client Side Rendering Print Provider "RemovePrintersAtLogoff" / 00000000
- Export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\SWD\PRINTENUM\PrintQueues , delete PRINTENUM Key it, then re-create it, then Import again all the Exported Items of PrintQueues
- Do the same step for HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Enum\SWD\PRINTENUM and HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\SWD\PRINTENU
- Restart the Server
Now, every Shared Printer on Print Server must be opened as security group (Ok, with AD Toolset / PS Scripts can do it relatively quickly, but..) and the description must match exactly the name of the shared printer.
Configure this Powershell Script on Logon:
$adsearch = "OU=PrinterMapping,OU=Groups,OU=VA,DC=contoso,DC=local"
$adsearchdef = "OU=PrinterDefault,OU=Groups,OU=VA,DC=contoso,DC=local"
$psrv = "PRNT-SRV01"
Foreach($NetworkPrinter in $NetworkPrinters) {
$NetworkPrinter.Delete()
}
$pgrp = (Get-ADGroup -filter * -Searchbase $adsearch).name
foreach ($g in $pgrp) {
$groupmember = (Get-ADGroupMember $g -Recursive).samAccountName
foreach ($i in $groupmember) {
if($i -eq $env:USERNAME){
$gdesc = (get-adgroup $g -Properties Description).Description
$printer = get-printer -ComputerName $psrv -Name $gdesc
foreach ($p in $printer) {
add-printer -connectionname "\\$($psrv)\$($p.name)"
}
}
}
}
$pgrp = (Get-ADGroup -filter * -Searchbase $adsearchdef).name
foreach ($g in $pgrp) {
$groupmember = (Get-ADGroupMember $g -Recursive).samAccountName
foreach ($i in $groupmember) {
if($i -eq $env:USERNAME){
$gdesc = (get-adgroup $g -Properties Description).Description
$defprinter = Get-WmiObject -Query "Select * from Win32_Printer Where ShareName = '$gdesc'"
$defprinter.SetDefaultPrinter()
}
}
}
And this one on Logoff
Foreach($NetworkPrinter in $NetworkPrinters) {
$NetworkPrinter.Delete()
}
Honestly I really hope there is another way. It can't be that Microsoft is just sitting and doing nothing, no wonder there are so many 3th party Print Server software. I don't think I'm asking so much, I just want that my users can connect their printer and the default printer doesn't get lost every time.
Even with this workaround I won't fix the issue permanently, as explained, the major issue is that the default printer get lost even if a user DISCONNECT the RD Session and then reconnect, the Default Print switches back to the PDF Printer, therefore there is something really wrong that is related to RDS Session - if the issue would happen only during Logout/Login I could understand and the workaround above would work, but the fact that the default printer is lost even with session disconnect/reconnect (happens with domain admin as well, global issue, so nothing about permissions) is really freaking me out.
I will try on the testing RDSh what you suggested, maybe this will fix the issue already..but I really think I need to clean up the register properly. I also don't understand why under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider\Servers I've 4 Print Servers listed with different Printers as well in the sub-keys. One was a test print server, but the other 3 are actually the same but with different printers.. (one is the printserver_hostname, one is printerserver_hostname.domain and the last one the IP Address of the printserver_hostname.)
What a mess just for keeping a STANDARD PRINTER for Users.