Duplicate drivers check

slownumb

New Member
I gave a quick search to see if this was suggested before but haven't found anything.
It would be nice if NTLite featured a way to compare driver versions that are being added to the queue.
This way we could import the entire DriverStorage folder and each time there are multiple drivers with same .inf file we are prompted to select which one to keep importing and which ones to discard. Or even a option to keep only the driver with latest version number or latest release date.
 
I made a thread (link1) that is related and might help, to exclude unused drivers. I know where you're coming from with wanting to simplify things, but trying to load tons of unneeded drivers into NTLite is generally a bad method of setting up a computer and shouldn't be encouraged. Here's a thread (link2) that walks people through drivers and firmware. It is better for optimization to download the latest and official drivers, directly from the hardware manufacturers whenever you need to reinstall Windows or make a new image in NTLite.
 
Last edited:
I don't know if NTLite will add this feature, but it can be done by a PowerShell script.

This script reads an existing NTLite preset file, extracts the date & driver version in each listed INF file, and picks a single winner (by date or version). It then saves the cleaned up preset under a new file in your current directory.

Code:
powershell -f DriverWinners.ps1 "C:\Program Files\NTLite\Presets\DRIVERS.xml" -Date

INF          Arch    Date       Version        Filename
---          ----    ----       -------        --------
S6000CVD.inf neutral 06/03/2015 2.44.50.23     C:\Drivers\Camera Driver (Bison, AVC)\Bison\2.44.50.23\Driver\S6000CVD.inf
RtLeShA.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShA.inf
RtLeShF.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShF.inf
RtLeShL.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShL.inf
RtLeShV.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShV.inf
RtLeSLF.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeSLF.inf

Saved to "C:\Users\GARLIN\Downloads\DRIVERS-CLEANED.xml"
Code:
powershell -f DriverWinners.ps1 "C:\Program Files\NTLite\Presets\DRIVERS.xml" -Version

INF          Arch    Date       Version         Filename
---          ----    ----       -------         --------
S6000CVD.inf neutral 06/03/2015 2.44.50.23      C:\Drivers\Camera Driver (Bison, AVC)\Bison\2.44.50.23\Driver\S6000CVD.inf
RtLeShA.inf  x64     06/11/2015 6.3.9600.11105  C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShA.inf
RtLeShF.inf  x64     06/11/2015 11.3.9600.11105 C:\Drivers\RtLeShF.inf
RtLeShL.inf  x64     06/11/2015 6.3.9600.11105  C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShL.inf
RtLeShV.inf  x64     06/11/2015 6.3.9600.11105  C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShV.inf
RtLeSLF.inf  x64     06/11/2015 6.3.9600.11105  C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeSLF.inf

Saved to "C:\Users\GARLIN\Downloads\DRIVERS-CLEANED.xml"

Running the script without a -Date or -Version argument, will default to -Version. The cleaned preset is always saved to the current folder.
 

Attachments

  • DriverWinners.zip
    1.2 KB
I made a thread (link1) that is related and might help, to exclude unused drivers. I know where you're coming from with wanting to simplify things, but trying to load tons of unneeded drivers into NTLite is generally a bad method of setting up a computer and shouldn't be encouraged. Here's a thread (link2) that walks people through drivers and firmware. It is better for optimization to download the latest and official drivers, directly from the hardware manufacturers whenever you need to reinstall Windows or make a new image in NTLite.
Regarding exclude unused drivers option: it greatly simplifies the process indeed. The problem is that it seems to choose the currently used drivers to keep and it's known that windows update likes to install (and ensure that it keeps installed) old drivers.
I know theres a way to prevent this behavior and I'll use it in my next build.
Thank you for your response. And thanks for your guides as well. They are great!

I don't know if NTLite will add this feature, but it can be done by a PowerShell script.

This script reads an existing NTLite preset file, extracts the date & driver version in each listed INF file, and picks a single winner (by date or version). It then saves the cleaned up preset under a new file in your current directory.

Code:
powershell -f DriverWinners.ps1 "C:\Program Files\NTLite\Presets\DRIVERS.xml" -Date

INF          Arch    Date       Version        Filename
---          ----    ----       -------        --------
S6000CVD.inf neutral 06/03/2015 2.44.50.23     C:\Drivers\Camera Driver (Bison, AVC)\Bison\2.44.50.23\Driver\S6000CVD.inf
RtLeShA.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShA.inf
RtLeShF.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShF.inf
RtLeShL.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShL.inf
RtLeShV.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShV.inf
RtLeSLF.inf  x64     06/11/2015 6.3.9600.11105 C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeSLF.inf

Saved to "C:\Users\GARLIN\Downloads\DRIVERS-CLEANED.xml"
Code:
powershell -f DriverWinners.ps1 "C:\Program Files\NTLite\Presets\DRIVERS.xml" -Version

INF          Arch    Date       Version         Filename
---          ----    ----       -------         --------
S6000CVD.inf neutral 06/03/2015 2.44.50.23      C:\Drivers\Camera Driver (Bison, AVC)\Bison\2.44.50.23\Driver\S6000CVD.inf
RtLeShA.inf  x64     06/11/2015 6.3.9600.11105  C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShA.inf
RtLeShF.inf  x64     06/11/2015 11.3.9600.11105 C:\Drivers\RtLeShF.inf
RtLeShL.inf  x64     06/11/2015 6.3.9600.11105  C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShL.inf
RtLeShV.inf  x64     06/11/2015 6.3.9600.11105  C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeShV.inf
RtLeSLF.inf  x64     06/11/2015 6.3.9600.11105  C:\Drivers\Camera Driver (Bison, AVC)\Bison\6.3.9600.11105\DrvBin64\RtLeSLF.inf

Saved to "C:\Users\GARLIN\Downloads\DRIVERS-CLEANED.xml"

Running the script without a -Date or -Version argument, will default to -Version. The cleaned preset is always saved to the current folder.

This is very cool. Thank you.
I have been trying to do this with a python script with a not as elegant aproach. But it's rather unreliable. Sometimes it fails to keep the most up-to-date version.
I'll give this a try tomorrow.
Guess i'll try to learn some powershell scripting. I had no idea that it could be so versatile. First time I stumbled upon a complex script was with uupdump one and it was very cool.
 
Just tried the script and noted that it was keeping drivers with lower version numbers and date.
To troubleshoot, I added a 'Write-Output $Drivers' right after the variable declaration block and noted a large amount of drivers sharing the same driver number.
While I know some devices share same driver and thus same version, this was unusual high amount.
On manual inspection of the INF files, the script was indeed fetching the wrong version.
Sem título1.jpg

I haven't had time to find out what's happening but I suspect it could be the file encoding preventing the script to get the right driver number.
I'll dig more into it on the following days.
 
The version is correct, it's based on the INF's self-reported DriverVer. What is a problem is after you group similar sets together, how do you pick which one to keep? Same INF -> same highest driver name -> now which folder if there are dupes?

Similar problem with Same INF -> same latest date -> dupe folders.

If you have multiple INF's, can you zip them up? Like copy your driver folder(s) to another location. Then delete everything except the INF files, leaving them inside each folder so I can test against your driver library.
 
I found out what the problem was for me.
Some drivers have more than one DriverVer in them. When you loop thru all lines for each INF and it has more then one DriverVer, the latter version gets picked. So a simple "Select-Object -First 1" would do it because the first occurrence of the DriverVer is always the right one.

I got your script and tailored to my needs.
Right now it takes no arguments. It save files based on version alone.
 

Attachments

  • DriverChampions.zip
    900 bytes
Thanks for the update, but you're not correctly interpreting the Windows INF:
Starting with Windows 2000, INF files must have a DriverVer directive in their INF Version sections to provide version information for the whole INF. Individual INF DDInstall sections can also contain DriverVer directives to provide version information for individual drivers. DriverVer directives in the DDInstall sections are more specific and take precedence over the global DriverVer directive in the Version section.

"Select -First 1" wouldn't necessarily be the correct version, and you would have to parse the x86 or amd64 sections. Now by common practice, they normally match but one day you may get unlucky.
 
Thanks for the update, but you're not correctly interpreting the Windows INF:


"Select -First 1" wouldn't necessarily be the correct version, and you would have to parse the x86 or amd64 sections. Now by common practice, they normally match but one day you may get unlucky.
Thank you for the clarification.
I thought that since I only have amd64 drivers on that folder, that those where the ones I will always need. So I skipped this part entirely.
I'll be working on the script again to add this sometime.
 
Back
Top