Paginas

28 May 2017

Terminal Server. Windows cannot connect to the printer. Error 0x00000002




A few days ago I had a customer with a problem that was as follows:
  • In a RDS Farm (Terminal Server) some users cannot print to any printer
  • It was only happening in one server of the Farm
  • some users logged in on the same server had no problem at all and could print to their preferred printer. The error was 0x00000002
  • Some users reported that they didn’t get their printer(s) mapped by Script when they logged in to that specific RDS server
  • The Terminal Servers were in Windows Server 2008 x86
Let´s see how to resolve this:




While analyzing this problem, we found out that the printers which didn’t got connected used the same printer drivers. Printers using the Xerox Global Printer Driver or HP Universal Printer Driver  were not available on this RDS server. When connecting to a network printer using the Xerox Global Printer Driver of HP UPD manually, the following error was shown:

Windows cannot connect to the printer.
Operation failed with error 0x00000002. 

The error code HRESULT 0x80070002 or 0x00000002 means that the system cannot find the specified file.
 

 
This problem also occurred with my administrator account. This problem could not be reproduced on other RDS servers in this RDS farm.Several trouble-shooting steps were carried out. Like restarting the spooler service, rebooting the server and even removing all of the the printer drivers including a manual cleanup of registry related  printer settings.
But when I tried to connect to a printer using the Xerox Global Printer Driver or HP Universal Printer Driver, the download of the printer driver from the print server still failed with the same error.
Printers using other drivers could be downloaded and connected.
 
With Process Monitor we could find the cause of this problem. When spoolsv.exe performed a CreateFile operation in the directory C:\Windows\System32\spool\prtprocs\x64 It tried to create a sub folder with the number "1" but that directory already exists, so it tries to create a sub folder named "2" but that one already exists too. This continues till number 499. After that is stops.
When viewing the contents of C:\Windows\System32\spool\prtprocs\x64, it indeed contains sub folders named from 1 to 499. Contents of C:\Windows\system32\spool\prtprocs\x64
 
 
When viewing the contents of these sub folders they all contain a single dll file named Xrprt_b.dll.
Contents of C:\Windows\system32\spool\prtprocs\x64
 
 
This is a dll related to the Xerox printer driver
I decided to delete all of these sub folders from 1 through 499. (Stop spooler service and restart afterwards). After doing so, I tried to connect again to a printer using the Xerox Global Printer Driver and the printer driver was downloaded successfully and the printer was connected!
Also a printer using the HP UPD was connected successfully too.
 
I added and removed all of the printers from the print server multiple times, and checked the C:\Windows\System32\spool\prtprocs\x64 folder.
No sub folder named 1 through 499 was left behind.
 

No comments:

Post a Comment