Friday, August 5, 2016

XenApp - print spooler failed to import the printer driver



Problem 
We have a XenApp deployment here. Occasionally, a print driver fails to load on one of the application servers. Since we have dozens of these that spin up from the golden image every night, the problem will resurface eventually. 

In our environment, we are using 2 print servers, with point and print enabled. We push out printer connections via group policy. Since this is a high traffic Citrix environment, we have multiple users that are connected. The server they are connected to is randomly determined. 

If we reboot an affected server, it will usually work fine. You can connect to the shared printer and move along. This is not a good solution when rebooting the server will disrupt several users, however. I wanted to find the real root cause of the issue. The issue is sporadic, and seemingly random.

Problem Part 1 - No default Printer
When Windows has no default printer, certain things don't work. 
I'll give you an example you can see for yourself.
Lets delete the registry key for the current printer in powershell:
$Device = (Get-ItemProperty 'HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows').Device

Set-ItemProperty 'HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows' -Name Device -value $null

Check Devices and printers, verify that there is no default printer selected at all.
If you did this correctly, you can open up Internet Explorer, Navigate to any website, and click Print Preview.
What you should see is, well... nothing.. 
And that's the problem. Essentially, this is an unhandled exception within windows. 
Now, for some reason, this won't affect versions of IE lower than 10. I think IE9 and below use a different print management system.
This also typically will not affect other applications like Google Chrome, which seem to work fine without a default printer. 

Problem Part 2: Driver Installation Failed, Driver Store Missing inf
The next part of the problem is the killer. Once a driver fails to install, any printer utilizing that driver will not load. 
Key Observations
Event 600: Client Side Rendering
Log Name:      Microsoft-Windows-PrintService/Admin
Source:        Microsoft-Windows-PrintService
Date:          8/5/2016 8:04:53 AM
Event ID:      600
Task Category: Client-side rendering
Level:         Error
Keywords:      Client Side Rendering (CSR),Classic Spooler Event
User:          SYSTEM
Computer:      ctximg6-0001.contoso.com
Description:
The print spooler failed to import the printer driver that was downloaded from \\Print2\print$\x64\PCC\oemsetup.inf_amd64_48ea2774648628eb.cab into the driver store for driver RICOH MP 2554 PCL 6. Error code= 80070020. This can occur if there is a problem with the driver or the digital signature of the driver.
Event Xml:
    Microsoft-Windows-PrintService/Admin
    ctximg6-0001.contoso.com

      \\Print2\print$\x64\PCC\oemsetup.inf_amd64_48ea2774648628eb.cab
      RICOH MP 2554 PCL 6
      80070020

Event 601: Client Side Rendering
Log Name:      Microsoft-Windows-PrintService/Admin
Source:        Microsoft-Windows-PrintService
Date:          8/5/2016 8:04:53 AM
Event ID:      601
Task Category: Client-side rendering
Level:         Error
Keywords:      Client Side Rendering (CSR),Classic Spooler Event
User:          Contoso\User1
Computer:      ctximg6-0001.contoso.com
Description:
The print spooler failed to download and import the printer driver from \\Print2 into the driver store for driver RICOH MP 4054 PCL 6. Error code= 80070003.
Event Xml:

    Microsoft-Windows-PrintService/Admin
    ctximg6-0001.contoso.com

      \\Print2
      RICOH MP 4054 PCL 6
      80070003
  
Event 215: Installing a Printer Driver (Hundreds of these)
Log Name:      Microsoft-Windows-PrintService/Admin
Source:        Microsoft-Windows-PrintService
Date:          8/5/2016 8:13:41 AM
Event ID:      215
Task Category: Installing a printer driver
Level:         Error
Keywords:      Printer Setup,Printer
User:          SYSTEM
Computer:      ctximg6-0001.contoso.com
Description:
Installing printer driver RICOH MP 4054 PCL 6 failed, error code 0x3, HRESULT 0x80070057. See the event user data for context information.
Event Xml:
    Microsoft-Windows-PrintService/Admin
    ctximg6-0001.contoso.com
   
      IsInfInDriverStore failed
      -
      C:\Windows\System32\DriverStore\FileRepository\oemsetup.inf_amd64_neutral_48ea2774648628eb\oemsetup.inf
      RICOH MP 4054 PCL 6
      -
      Windows x64
      Not package aware
      -
      0x3
      0x80070057

Testing: Is there anything at the INF Path?
On CTXIMG6-0001 , open C:\Windows\System32\DriverStore\FileRepository\oemsetup.inf_amd64_neutral_48ea2774648628eb\

Okay, so we know the folder isn't there, so it never made it to the repo.

What about the Cab file? Can this be accessed from the CTXIMG and dropped in manually?

The Cab File opens fine, so the computer should have had access

Adding the Directory Manually
I added the directory to C:\Windows\System32\DriverStore\FileRepository\oemsetup.inf_amd64_neutral_48ea2774648628eb, the location Point and Print was looking for the driver. Also, Note that this is different from the cab file name on the print server. This indicates to me that Point and Print keeps track of the folders, and names them according to it's own convention.
It took some fiddling with psexec and Nt Authority\System in order to drop the file in the correct location, as the DriverStore is locked down.

Once the file was added, I popped open a Run Dialog, and keyed in the path to the printer, and it worked!

So what Happened?
I'm not entirely sure yet, but it could be one of the following.
Theory 1:
Point and Print goes to download the Cab file from the print server, but the download fails.
Point and Print does not update its records to show that this failed, and thus expects that the inf file is there, as seen in Event 215.

Theory 2: 
2 or more users try to download the printer driver at the same time, causing the Point and Print system to mess up, and enter an unhealthy state. They both think the file is downloaded, but it isn't.

What can be done to fix this:
I am hoping that it is possible to preload drivers onto the Golden Image. I'm thinking if I created a driver store on the Image, and set the Device Path in the registry to point to this as well, the Plug and Play/Point and Print (side note, does anybody know if Plug and Play and Point and Print are the same thing?). It would be fairly easy to navigate out to the print servers and copy all the printers from their share. My concern is understanding the format that PNP is looking for. Is it expecting Cab Files? Is it looking for the files to have the exact same names as it would have in the driver repository after a PNP download? Or, is it more lenient?

I'll be testing this over the next few weeks. Stay tuned for an update on what I have learned.

10 comments:

  1. Hello

    I know this is an old thread but did you ever figure out what was happening?
    We experience the same issue with our provisioned servers. So I am very interested if you figured out why.

    Best regards

    Ib

    ReplyDelete
  2. These printers are perfect for printing high contrast content and basic illustrations, so you may need to get a different inkjet or photograph printer with a specific end goal to print shading photographs - unless you wish to put resources into the more costly shading lasers that can print both high contrast and shading records.drukarki 3d

    ReplyDelete
  3. As a component of their printing administrations some give manages on picking picture documents and a simple to-utilize online office for transferring pictures.postcard printing

    ReplyDelete
  4. On the off chance that you purchased a used printer from a companion or from a store, make sure to request the establishment plate of that printer.Epson L565 Driver Printer Download

    ReplyDelete
  5. Photo printers are the obvious choice if printing photos is your main thing. Choose either the smaller, snapshot photo printer that produces 4x6-inch prints; or choose larger-sized, professional photo printers that are capable of delivering tabloid-size 11x17-inch prints -- even up to full-bleed 13x19-inch prints that include a border to allow room for registration marks.cheap 3d printer

    ReplyDelete
  6. Each word composed has enraptured its crowd in the most remarkable way.
    miniature printer

    ReplyDelete
  7. A printing organization with gifted, obliging printing staff esteems clients. For printing organizations realize that they aren't doing simply a business exchange however constructing an association with you, as customers and accomplices.Fine art printing NYC

    ReplyDelete
  8. Inkjet printers are accessible from shoddy passage level to top of the line business use machines and can print from photograph size prints to enormous A2 and greater sizes, there are models for infrequent use and others for high volume print occupations as well.cartucce compatibili

    ReplyDelete
  9. Brother MFC-L2707DW All-in-One Laser Printer: Electronics. ... Brother deleted my first review, resubmitted, brother hl-l2305w manual

    ReplyDelete
  10. Online, you'll be able to|you probably can} run all those video games simultaneously with a few of} servers and no overheads or staff to maintain up}. What makes poker a 1xbet korean players' favorite is that, unlike to|not like} most gambling video games, little is left to luck. Strategy, talent, and psychology are elementary components of this game's variants and are overall much more necessary than easy luck. As the sport is extremely in style in casinos worldwide, it is not surprising that the web version can also be|can be} a player's favorite. The adrenaline spike that blackjack provides you has few equals on a green table.

    ReplyDelete