Saturday, April 05, 2014

Fixing print drivers missing dependent files

I was having an issue with print drivers that felt corrupt. My quick way to fix a broken machine was to reset the spooler and delete the driver quickly in print management before it was locked by the spooler. Some times it took a few tries but it worked.

I continued to investigate the issue and it lead me to a set of registry keys that defined the print drivers along with the dependent files. My broken computers had a null key for the dependent files. I was able to write a script to identify the broken drivers.

#Quick check for bad printer driver
$keys = Get-ChildItem 'HKLM:\system\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\'
    $keys | ?{$_.Name -notmatch "Microsoft enhanced Point and Print compatibility driver|Amyuni Document|Microsoft Office|OneNote|Foxit Reader"} |
        ?{ !((Get-ItemProperty -Path ("Registry::" + $_.name))."Dependent Files")}

I figured out that I could delete the driver key from this location and the spooler would download the correct driver from the print spooler after it was restarted. Delete key and restart the service. I ended up with this script:

#Quick fix bad printer driver
$keys = Get-ChildItem 'HKLM:\system\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\'
$keys | ?{$_.Name -notmatch "Microsoft enhanced Point and Print compatibility driver|Amyuni Document|Microsoft Office|OneNote|Foxit Reader"} |
    ?{ !((Get-ItemProperty -Path ("Registry::" + $_.name))."Dependent Files")} |
    %{ ($_ | Remove-Item); Restart-Service spooler -force}
 

The nice thing about an identify and repair script like this is that I can run this remotely on all the computers that we have. It turns out that 10% of our computers had this issue.

I investigated several of these before I fixed them. I found issues from printing silently failing, to printing artifacts, to printers ignoring settings (like print dual sided), to advanced settings that were just missing. I think this issue is accounting for a lot more service calls that I initially gave it credit for.

I now have a script that I can run building wide to fix this problem. While that is good, I still don't have a fix that prevents the problem.

There are several threads talking about this issue and I think Microsoft has a patch in the works.
http://social.technet.microsoft.com/Forums/windowsserver/en-US/08bc6b4b-0190-40b0-be16-8b82249148e4/print-driver-being-modifyied?forum=winserverprint
http://social.technet.microsoft.com/Forums/windowsserver/en-US/e2acb625-027d-47a9-b4a7-1616e270bcbc/print-drivers-on-windows-7-clients-missing-dependent-files?forum=winserverprint
http://forum.support.xerox.com/t5/Printing/Secure-Print-5330-7545-5745-Basic-Mode/m-p/13445#M2980
http://support.microsoft.com/kb/2864755