1. Leif Olsson
  2. PowerBuilder
  3. Wednesday, 4 December 2019 13:41 PM UTC

Scenario:
- In Windows client printer settings "Let Windows manage my default printer" is checked
- Local printers are redirected to remote server
- Our PowerBuilder application starts through RemoteApp

Issue: At first print in a RemoteApp-session PrintGetPrinter() function seems to randomly get a printer (and not the last used in client).
When the user has printed, the PrintGetPrinter() function gets the last used printer. But only in that session.

There are printerfixes in PowerBuilder 2019 regarding Windows server 2016, but those fixes does not resolve this issue.
We have the same problem with runtime for PowerBuilder 2017 R3 and PowerBuilder 2019. We have added the Swedish language pack to the runtime.

I have searched this forum and the Internet. The only suggestions is to turn off setting "Let Windows manage my default printer". Fine with me,
but not accepted by our customers.

I have also seen that Microsoft has changed registry keys that handles default printer (also mentioned in this forum):
[With the release of server-2012 and up (2016, 2019), Microsoft changed
the location of terminal-server default printer from:
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Terminal Server
Client\DefaultPrinter"
to:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Windows\SessionDefaultDevices\<session>\Device".]

Is this issue a bug in PowerBuilder or is the solution to change some settings on the server or?

/Leif

Leif Olsson Accepted Answer Pending Moderation
  1. Thursday, 10 June 2021 11:50 AM UTC
  2. PowerBuilder
  3. # 1

After a customer reported problems with printer management, we performed deeper analyzes and tests. The ugly solution has been replaced with a major overhaul of our printer management.

The basic problem is that the user's session on the Windows server when RemoteApp is used is not fully initialized when our product has started. In any case, there is a delay before the printer setup is complete. Delay appears to be greater if printers are installed on the server and should be combined with the user's included printers. If Single Sign On is activated in our product, the problem becomes even greater, as the session may otherwise have time to be completed while the user fills in the login form.

We have taken the following steps to get around the problem:

1. Previously, we asked for available printers and standard printers when opening a window that has print options. Now: We only ask when the user chooses to make a preview / select printer for printer printing. Then hopefully so much time has passed that the session is completed.

2. To find out which is the user's default printer, we use option d) (as shown below) if this has a value. If key / value is missing, alternative b) is used. A solution that also works in cases where the installation is not on an RDS server. Function PrintSetPrinter is called with the result of the evaluation.

3. As long as the user has not printed on a printer, no session printer is set to 'permanent' - we are looking for standard printers according to point 2. Ie. as long as the user only prints on print media other than the printer or does a preview, we can finally get the correct default printer once the Windows session is complete. After the first print to printer during a session, we call PrintGetPrinter() in all subsequent prints.

4. More controls and error handling.

This is a picture from a little program I made to find standard printers in five different ways. Has run the program via RemoteApp. Here everything is the same, but it can vary a lot when you run it several times during the first seconds of a session. Also varies with how printers are installed. The result led to the handling according to point 2 above.

Comment
  1. Armeen Mazda @Appeon
  2. Thursday, 10 June 2021 13:22 PM UTC
Thanks for sharing the solution!
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Tuesday, 15 June 2021 14:29 PM UTC
By the way, we have fixed this issue in the upcoming MR for PB 2019 R3.
  1. Helpful
There are no comments made yet.
Leif Olsson Accepted Answer Pending Moderation
  1. Thursday, 5 December 2019 15:28 PM UTC
  2. PowerBuilder
  3. # 2

Thanks Chris for quick response!

Now I have received answers to your questions from cloud technicians:
1. We use Microsoft's Hyper-V virtualization.
2. Microsoft Windows Server Version 6.3 (Build 9600)

The heading has thus become wrong on this case, since 6.3 is Windows Server 2012 R2. On the other hand, it should be the same conditions as in Windows Server 2016, since the default management of printers is redone from the 2012 version?

Regards
/Leif

Comment
  1. Vipin Dwivedi
  2. Tuesday, 2 March 2021 07:19 AM UTC
Hello Leif,



Did you get any solution for that printer issue in windows 2016 server? Our application also runs through terminal where we RDP the application. When we run the application from the server itself then it highlights the default printer but not when we application through RDP.



Let me know if you found the solution.



Vipin
  1. Helpful
  1. Leif Olsson
  2. Tuesday, 2 March 2021 07:56 AM UTC
Hi Vipin,



we still live with the "ugly solution" described above and it seems to work because our customers are silent.. I have not seen or heard anything more from Appeon in this case in buglists or so.



Note! If current servers can be run in a language other than English, you will need to expand the search for "redirected". We also search for the word in Swedish.



Leif
  1. Helpful
  1. Leif Olsson
  2. Thursday, 10 June 2021 11:56 AM UTC
Vipin, se new reply from me 2021-06-10. /Leif
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 4 December 2019 16:01 PM UTC
  2. PowerBuilder
  3. # 3

Hi Leif;

  Can you tell us ...

1) Is this native MS-Windows or on a VM / Citrix environment?

2) What version & build of MS-Windows?

Regards ... Chris

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.