G
G
glukonator2020-07-13 10:15:58
RDP
glukonator, 2020-07-13 10:15:58

The default printer crashes when the Win Server 2019 RDP session is disconnected. How to fix it?

Hello.
Server - Win Server 2019 Standart
Client - Win 10 Pro
The server is not in a domain, everyone is in the same workgroup. A shared HP printer is installed on the server under the user account (the printer is connected to the PC of the same user). If you close the RDP session, then "Default" moves to another printer. How to fix it?

- The checkbox for managing the default printer of the OS itself is unchecked.
- There is no forwarding of printers via RDP (disabled in the connection settings on the client side)
- Local policies on the server are not configured (I'm talking about Printers in the PC and user configuration)
- From roles - only RDP (I repeat, there is no AD)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
ZardoZAntony, 2021-02-21
@ZardoZAntony

Same problem.
It looks like Win Server 2019 can't remember shared remote printers by default. Although he has no problems with network ones, tk. he sees them as local.
I thought the good old connection through the creation of LocalPort would help. But my printer does not print like that, it gives an error when printing. "Error 87. Invalid parameter."
In general, I did what I needed with crutches:
1. In the scheduler, we make a task to export the registry key with the default printer settings. Made so that the default printer change triggers do not twitch.

reg export "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" %USERPROFILE%\defprinter.reg /y

The event filter is manual. Here I am hooking to the default printer change log event. Changing the printer when disconnecting from the session occurs as if we had previously selected the default printers. This is what I got hooked on. OldDefaultPrinter becomes equal to a dash, so we will exclude it, and we will catch the rest of the printer changes.
<QueryList>
  <Query Id="0" Path="Microsoft-Windows-PrintService/Admin">
    <Select Path="Microsoft-Windows-PrintService/Admin">*[System[(Level=4 or Level=0) and (EventID=823)] ]
</Select>
    <Suppress Path="Microsoft-Windows-PrintService/Admin">
*[UserData[ChangingDefaultPrinter[(OldDefaultPrinter='-')]]]
</Suppress>
  </Query>
</QueryList>

Now, when changing the printer, the user's home folder contains a reg file with the current default printer.
2. We create a second task in the scheduler to import this file into the registry when connecting and reconnecting the user Triggers 2 pieces. These are the user login event and the session reconnect event. Microsoft-Windows-TerminalServices-LocalSessionManager/Operational log Events 21 and 25 Tasks in the scheduler on behalf of the Users group
reg import %USERPROFILE%\defprinter.reg

E
Egor, 2021-07-05
@EgorL

I did as it says in the solution. It works manually, but
for some reason the tasks are launched on behalf of the user whose profile was created last.
UPD: Found a solution to the main theme
Add the following key on the RD Server:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider
REG_DWORD: RemovePrintersAtLogoff
VALUE: 0
This will prevent removal of custom printers on logoff/shutdown and will not let you forget the default printer.
After that, for the fastest effect, it is necessary to correctly end the user session at least once.
I see the problem in the desynchronization of tasks for restoring user printers and restoring the default printer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question