HP Printers – “Printer driver is not installed” on Windows 2008 R2

Recently I migrated all our printers from a Server 2003 R2 x32 print server to Server 2008 R2 (x64). During this upgrade all the printers had x64 drivers added and their security settings checked. However, I kept experiencing problems in Print Management with the HP printers reporting the Printer driver is not installed, even after it had been repeatedly added and appeared in list of installed drivers.

Finally I found a Technet discussion on the issue, which correctly identified an incorrect registry value HPTrayCount which is set to 0 when the printer driver is changed, but is not set back to a working value.

This value needs to be changed to 0x12 (decimal 18) for each HP printer for it to work correctly. However, on print servers with lots of HP printers this can be very time consuming. To speed this process I have written the vbscript below which will check if the value exists for each printer, and if it is set to 0 will set it to 0x12.

' For each Printer in Registry check if HPTrayCount exists and is set to 0, then set to 12

'http://social.technet.microsoft.com/Forums/en/winserverprint/thread/5101195b-3aca-4699-9a06-db4578614e2d

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers"
strValueName = "HPTrayCount"
inHPValue = 18 ' Is equal to Hex 12, makesprinter driver work.

'http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/#EnumRegVals.htm
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

' Get list of Printers
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
  ' Read in HP Tray value
  strPrintPath = strKeyPath & "\" & subkey & "\PrinterDriverData"
  oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strPrintPath,strValueName,dwValue
  If Not IsNull (dwValue) And dwValue = 0 Then
    'If Exists and 0 then set it to a real value to make it work
    StdOut.WriteLine subkey & ": HP Tray: " & dwValue
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strPrintPath,strValueName,inHPValue
  End If
Next

About James Rudd

Network Administrator at Sydney Boys High School
This entry was posted in Windows and tagged , , , , , , , , , , . Bookmark the permalink.

One Response to HP Printers – “Printer driver is not installed” on Windows 2008 R2

  1. Pingback: Server 2k8 Printer Driver Is Not Installed On This Computer - TheITBros

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.