Windows 7 Forcibly Change Driver Remotely Using devcon

From richud.com
Jump to: navigation, search


Example driver update for a HP Laserjet P2055 printer

Plugging a P2055 into Windows7 will automatically install the Universal Driver if they already present on the machine - just adding the P2055 drivers remotely won't change it as it thinks the Universal ones are best. You need to forcibly change the universal ones to the 'proper' ones!

  • Note have renamed 64bit devcon.exe to devcon64.exe
  • Note I have used psexec to remote in to make it simpler, (I think you could use -m:\\remove_machine instead - test this , todo)

find anything relating to HP in the instance ID's

c:\TEMP\DRIVER\laserjet P2055>c:\temp\devcon64.exe findall * | findstr /i HP
USB\VID_03F0&PID_5C17&MI_01\6&3528BEF&0&0001                : HP EWS P2050 Series
SCSI\CDROM&VEN_HP&PROD_DVD-RAM_UJ8E1\4&1C5CDE5&0&020000     : hp DVD-RAM UJ8E1 SCSI CdRom Device
USBPRINT\HEWLETT-PACKARDHP_LASERJET_P2055D\7&2D15663C&0&USB001: HP Universal Printing PCL 6

The relevant ones are the 'HP USB EWS-FX Bulk Driver' aka HP EWS P2050 Series, USB\VID_03F0&PID_5C17&MI_01

and

the actual printer driver 'HP Universal Printing PCL 6', USBPRINT\HEWLETT-PACKARDHP_LASERJET_P2055D

Find relevant hardware ID's from Instance ID's (nodes)

  • Note remember instance ID's , prefix with '@'

EWS hardware ID

  • Note subtle difference between node ID and Hardware ID (REV0001 bit)
c:\TEMP\DRIVER\laserjet P2055>c:\temp\devcon64.exe hwids "@USB\VID_03F0&PID_5C17&MI_01*"
USB\VID_03F0&PID_5C17&MI_01\6&3528BEF&0&0001
    Name: HP EWS P2050 Series
    Hardware ID's:
        USB\VID_03F0&PID_5C17&REV_0001&MI_01        <<< Hardware ID
        USB\VID_03F0&PID_5C17&MI_01
    Compatible ID's:
        USB\Class_ff&SubClass_01&Prot_01
        USB\Class_ff&SubClass_01
        USB\Class_ff
1 matching device(s) found.

printer hardware ID

c:\TEMP\DRIVER\laserjet P2055>c:\temp\devcon64.exe hwids "@USBPRINT\HEWLETT-PACKARDHP_LASERJET_P2055D*"
USBPRINT\HEWLETT-PACKARDHP_LASERJET_P2055D\7&2D15663C&0&USB001
    Name: HP LaserJet P2050 Series PCL6
    Hardware ID's:
        USBPRINT\Hewlett-PackardHP_La39AE        <<< Hardware ID
        Hewlett-PackardHP_La39AE
1 matching device(s) found.

Find correct .inf, search using Hardware ID

Look through the inf files for the relevant one for each device, findstring is looking for either of these strings "Hewlett-PackardHP_La39AE" or "VID_03F0&PID_5C17"

c:\TEMP\DRIVER\laserjet P2055>type "hppdp613.inf" | findstr /i "Hewlett-PackardHP_La39AE VID_03F0&PID_5C17"
"HP LaserJet P2050 Series PCL6"=HPC20556.GPD.NTAMD64,USBPRINT\Hewlett-PackardHP_La39AE,Hewlett-PackardHP_La39AE
"HP LaserJet P2050 Series PCL6"=HPC20556.GPD.NTAMD64.6.0,USBPRINT\Hewlett-PackardHP_La39AE,Hewlett-PackardHP_La39AE

Above is the printer driver inf

c:\TEMP\DRIVER\laserjet P2055>type "hppaew13.inf" | findstr /i "Hewlett-PackardHP_La39AE VID_03F0&PID_5C17"
%DESCR1%=DriverInstall,USB\VID_03f0&PID_5C17&REV_0001&MI_01
%DESCR1%=DriverInstall.NTAMD64,USB\VID_03f0&PID_5C17&REV_0001&MI_01
%DESCR1%=DriverInstall.NT.6.0,USB\VID_03f0&PID_5C17&REV_0001&MI_01
%DESCR1%=DriverInstall.NTAMD64.6.0,USB\VID_03f0&PID_5C17&REV_0001&MI_01

Above is the EWS driver inf

  • Note these is a 3rd *.inf viz hpcp613.inf that will match, this is the 32bit drivers - in this example I want the 64 bit ones in hppdp613.inf

Update drivers

Basic pattern is

devcon <inf> <hardwareID>

Printer driver

c:\TEMP\DRIVER\laserjet P2055>c:\temp\devcon64.exe updateni "hppdp613.inf" "USBPRINT\Hewlett-PackardHP_La39AE"
Updating drivers for USBPRINT\Hewlett-PackardHP_La39AE from c:\TEMP\DRIVER\laserjet P2055\hppdp613.inf.
Drivers updated successfully.

EWS driver

c:\TEMP\DRIVER\laserjet P2055>c:\temp\devcon64.exe updateni "hppaew13.inf" "USB\VID_03F0&PID_5C17&REV_0001&MI_01"
Updating drivers for USB\VID_03F0&PID_5C17&REV_0001&MI_01 from c:\TEMP\DRIVER\laserjet P2055\hppaew13.inf.
Drivers updated successfully.

Check printer driver node

  • Note Is Using node 1
c:\TEMP>devcon64.exe drivernodes "USBPRINT\Hewlett-PackardHP_La39AE"
USBPRINT\HEWLETT-PACKARDHP_LASERJET_P2055D\7&2D15663C&0&USB001
    Name: HP LaserJet P2050 Series PCL6
DriverNode #0:
    Inf file is C:\Windows\INF\prnhp002.inf
    Inf section is hpmcpap6.gpd.Win7
    Driver description is HP LaserJet P2050 Series PCL6
    Manufacturer name is HP
    Provider name is HP
    Driver date is 21/06/2006
    Driver version is 6.1.7600.16385
    Driver node rank is 16715777
    Driver node flags are 00103044
        Inf is digitally signed
DriverNode #1:
    Inf file is C:\Windows\INF\oem173.inf
    Inf section is HPC20556.GPD.NTAMD64.6.0
    Driver description is HP LaserJet P2050 Series PCL6
    Manufacturer name is HP
    Provider name is HP
    Driver date is 15/04/2010
    Driver version is 61.93.2.77
    Driver node rank is 16711680
    Driver node flags are 00043040
        Inf is digitally signed
DriverNode #2:
    Inf file is C:\Windows\INF\oem170.inf
    Inf section is hpcu1506.gpd.NTAMD64
    Driver description is HP Universal Printing PCL 6
    Manufacturer name is HP
    Provider name is HP
    Driver date is 10/05/2013
    Driver version is 61.150.2.15717
    Driver node rank is 16711680
    Driver node flags are 00003040
        Inf is digitally signed
DriverNode #3:
    Inf file is C:\Windows\INF\oem171.inf
    Inf section is hpcu1186.gpd.NTAMD64
    Driver description is HP Universal Printing PCL 6
    Manufacturer name is HP
    Provider name is HP
    Driver date is 11/11/2011
    Driver version is 61.118.1.11744
    Driver node rank is 16711680
    Driver node flags are 00003040
        Inf is digitally signed
1 matching device(s) found.


Check printer using new driver files

  • Note they exist in c:\Windows\System32\spool\drivers\x64\3 , not C:\Windows\system32\spool\DRIVERS\x64\{5F501CAB-4110-4FB3-B274-94DF3F020FAC}
  • Note Using drivernode 1, the right driver, cached as oem173.inf (i.e. "Driver installed from C:\Windows\INF\oem173.inf" )
c:\TEMP\DRIVER\laserjet P2055>c:\temp\devcon64.exe driverfiles "USBPRINT\Hewlett-PackardHP_La39AE"
USBPRINT\HEWLETT-PACKARDHP_LASERJET_P2055D\7&2D15663C&0&USB001
    Name: HP LaserJet P2050 Series PCL6
    Driver installed from C:\Windows\INF\oem173.inf [HPC20556.GPD.NTAMD64.6.0]. 52 file(s) used by driver:
        C:\Windows\system32\spool\DRIVERS\x64\{5F501CAB-4110-4FB3-B274-94DF3F020FAC}\hpcp2055.cfg
        C:\Windows\system32\spool\DRIVERS\x64\{5F501CAB-4110-4FB3-B274-94DF3F020FAC}\HPC20556.xml
        C:\Windows\system32\spool\DRIVERS\x64\{5F501CAB-4110-4FB3-B274-94DF3F020FAC}\hpcsc093.dtd
<SNIP>

Notes

  • The print spooler needs to be running to update printer driver for some reason.
  • When adding the printer drivers with devcon (in x64) you should see files appearing/dissapearing in c:\Windows\System32\spool\drivers\x64\3

After doing the above the machine was rebooted and the Universal driver re-appeared (for printer, not EWS). (However I had been messing about with devcon prior to this working out what I was doing.) After repeating the install, stopping and starting the spooler, repeating install again, the machine rebooted and the driver stuck with correct one. Unfortunately Therefore I dont know what caused the reversion problem initially, but it definitely did work eventually. I will update this when I next try it.


Example - CM1312 MFP Scanner Driver Fixup

I will keep this short as it is similar to above.

So the scanner to this MFP is showing as "HP PNP Scan Null" in device manager under imaging devices but not showing as a scanner in control panel.

Lets see the device instance paths with 'HP' in them

c:\TEMP\DRIVER\CM1312series-win7-full-solution-AM-EMEA1-v5.1>devcon64.exe findall * | findstr /i HP
USB\VID_03F0&PID_4E17&MI_00\6&CB4A4B2&1&0000                : HP PNP Scan Null
USB\VID_03F0&PID_4E17&MI_02\6&CB4A4B2&1&0002                : HP EWS UPD
SCSI\CDROM&VEN_HP&PROD_DVDRAM_GTA0N\4&1C5CDE5&0&020000      : hp DVDRAM GTA0N SCSI CdRom Device
USBPRINT\HEWLETT-PACKARDHP_COLOR_LASERJET_CM1312_MFP\7&BDDD5F9&0&USB001: HP Color LaserJet CM1312 MFP Series PCL 6

Narrow it down a bit

c:\TEMP\DRIVER\CM1312series-win7-full-solution-AM-EMEA1-v5.1>devcon64.exe findall * | findstr /i PID_4E17
USB\VID_03F0&PID_4E17&MI_00\6&CB4A4B2&1&0000                : HP PNP Scan Null
USB\VID_03F0&PID_4E17&MI_01\6&CB4A4B2&1&0001                : USB Printing Support
USB\VID_03F0&PID_4E17&MI_02\6&CB4A4B2&1&0002                : HP EWS UPD

Anyway the printing is working so I wont fiddle with the other bits. So I need the hardware ID to the instance path USB\VID_03F0&PID_4E17&MI_00\6&CB4A4B2&1&0000

c:\TEMP\DRIVER\CM1312series-win7-full-solution-AM-EMEA1-v5.1>devcon64.exe hwids "@USB\VID_03F0&PID_4E17&MI_00*"
USB\VID_03F0&PID_4E17&MI_00\6&CB4A4B2&1&0000
    Name: HP PNP Scan Null
    Hardware ID's:
        USB\VID_03F0&PID_4E17&REV_0100&MI_00
        USB\VID_03F0&PID_4E17&MI_00
    Compatible ID's:
        USB\Class_ff&SubClass_02&Prot_01
        USB\Class_ff&SubClass_02
        USB\Class_ff
1 matching device(s) found.

Thus the Hardware ID is USB\VID_03F0&PID_4E17&REV_0100&MI_00

So there are 5 inf's in this driver bundle, looking through them [!!! not using grep as they are UTF-16 and it cannot see !!!], the one with this hardware is hpasc11.inf.

;Windows Vista 64
[HP.NTAMD64.6.0]
"HP CLJ CM1312 Scan"= WIA_1312_Inst_Vista64, USB\vid_03f0&pid_4E17&mi_00
"HP CLJ CM1312 Scan"= WIA_1312_NW_Vista64,vid_03f0&pid_4E17&IP_SCAN
"HP CLJ CM1312 Scan"= WIA_1312_Inst_Vista64, USB\vid_03f0&pid_4F17&mi_00
"HP CLJ CM1312 Scan"= WIA_1312_NW_Vista64,vid_03f0&pid_4F17&IP_SCAN

Update driver, remember to use the hardware ID, not the device instance path.

c:\TEMP\DRIVER\CM1312series-win7-full-solution-AM-EMEA1-v5.1>devcon64.exe updateni "hppasc11.inf" "USB\VID_03F0&PID_4E17&REV_0100&MI_00"
Updating drivers for USB\VID_03F0&PID_4E17&REV_0100&MI_00 from c:\TEMP\DRIVER\CM1312series-win7-full-solution-AM-EMEA1-v5.1\hppasc11.inf.
Drivers updated successfully.

Now it should show as "HP CLJ CM1312 Scan" !

Comments

blog comments powered by Disqus