cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problems with default printers on Windows Server 2016

Former Member
0 Likes
9,702

I'm having an issue with the CrystalReportViewer control when running an winforms application on windows 2016 server. When remoting into the server using Rempte Desktop Connection, we're selecting the option to use local devices and resources, including printers. This makes the default printer on the server the same as the default printer on the machine I'm remoting from. But when running my application to view the report, when I click the print button, my default printer is not automatically selected. Now, when I change the default printer to a printer already on the server, it works fine. It just doesn't seem to work with redirected printers. If I manually select one of the redirected printers, my report does print to the printer.

So far I've tried updating the runtime on the server, and setting the ReportDocument.PrintOptions.PrinterName. I wasn't previously setting that property unless it was printing directly (not going to the viewer). I've also been told (but not witnessed myself) that this did work in Windows Server 2012. Is there a better way to set the printer even though I want to initially view vs print?

Thanks in advance!

View Entire Topic
Former Member
0 Likes

We found some info on a Microsoft Technet forum thread that might help with this issue. Please look at this thread (https://social.technet.microsoft.com/Forums/ie/en-US/785cbcc6-4f0b-4d88-b12f-2b1d89b85a44/remoteapp-default-printer-redirection-not-working-in-server-2016?forum=winserverTS), specifically the post from 12/15/16 (the first one marked as an answer). It references 2 API calls. We created a small test program that would find and display the default printer information using the GetProfileString API call and also find and display the default printer information using the GetDefaultPrinter API call. Our hypothesis was that if we ran the test program on a Windows 2012 Server, both functions would display the same default printer path (the one redirected from the client). However, if we ran the test program on a Windows 2016 Server, the hypothesis was that the GetProfileString call would display the default printer path from that server and the GetDefaultPrinter call would display the default printer path redirected from the client (like Server 2012).

The results of our tests proved our hypothesis . . . the GetProfileString call displayed the default printer path from the client on 2012 server, whereas it displayed the default printer path from the server on 2016 server. The GetDefaultPrinter call displayed the default printer path from the client on both 2012 and 2016 servers.

Our guess is that the CrystalReportViewer control currently uses GetProfileString to determine the default printer path. What are the chances that SAP would update the CrystalReportViewer control to use GetDefaultPrinter instead? We would be happy to provide our test program if that would help. Thanks.