Vernalex.com
 
 M  E  N  U
 - Games
 - Guides
 - Links
 - Tools
 - Themes
 






 
 

Tools: SysPrep Driver Scanner for Windows 2000, XP, 2003, Vista, 7, 2008, 8 and 2012


Table of Contents

 

Introduction to SPDrvScn

Drivers DirectoryThe purpose of this tool is to provide system administrators an easy when to roll out ever-changing Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008, Windows 8 and Windows Server 2012 images that use the Microsoft System Preparation Tool (SysPrep) by using this tool to enumerate your Windows drivers. You provide the tool with a base directory path and a extension type. Then when you tell it to run a scan it will search through that directory along with all subdirectories for files that match your extension. The recommend search is for a SysPrep driver store and with the extension set to inf so that it properly enumerates drivers. It will then only pick up directories that contain those matched files, in this example *.inf files, and then add those settings into the Windows registry so that when the SysPrep mini-setup runs it will search those directories. This program is meant to be run right before the SysPrep resealing is started, so it is suggest you add it to a batch file that has this program precede your sysprep.exe execution. The program also accepts command-line parameters to automate the process.

Please note that this program makes it so you don't need a OemPnPDriversPath line in your sysprep.inf file for XP and 2003 or a DriverPaths in your sysprep's XML file for Windows Vista, 7, 2008, 8 or 2012. In fact, all that line does is copy that data into the registry when it's run. This is a must for XP because the OemPnPDriversPath can only be 4096 bytes, whereas the registry value can be as large as a REG_EXPAND_SZ, so you can have much larger paths this way. In fact there is no direct limit to the size of the registry key, but the key itself can't contain more than 64,000 bytes when combined with the other data values. You should be aware though that the more paths you provide to SysPrep for the minisetup the longer the Plug and Play detection time because each device needs to scan these directories for relevant INF files. Don't let that worry you though because the INF files are small and unless you have thousands of directories the time should be fairly low. And for Windows Vista, 7, 2008, 8 and 2012 it works better than the XML method.

Also, please let me know if you have any questions, comments or suggestions for this program.

If you have any problems or questions about SysPrep itself then you should read my SysPrep Guide for 2000/2003/XP or SysPrep Guide for Windows Vista/7/8/2008/2012 that explain how to use the Microsoft System Preparation Tool and the problems associated with it.

Return to top.

Instructions for General Usage

SPDrvScnThe program can be run in one of two ways. The first way is from the GUI and the second is from the command-line. They can also be used in conjunction with each other. Please read these instructions first and then read the section on command-line parameters as they will build off these instructions.

When the application is run you will be presented with an empty list. It will default the extension to "inf" and the "Search Path" to "C:\drivers", but these can be changed from the available edit boxes. Typically you will not want to change the default extension since I gave the option for potential flexibility.

When you press the "1. Scan" button it will recurse through the "Search Path" for all files that match the extension type. If this is a directory that contains a lot of files and/or subdirectories then it could take a few moments. When the scan is completed then you should verify that the directories listed are ones that you want.

You can refine the list by using the "Add" button to create manual entries from other directories that are not provided. You should most likely add "c:\windows\inf", where "c:\windows" is your Windows folder. This folder is the default search folder for Plug and Play detection, so you should make sure it gets added along with your SysPrep drivers.

You can also remove items from the list, so if you notice that it added folders that aren't applicable to your operating system then you can manually remove them. An example would be a driver bundle that contains drivers for Windows 95, 98, Me, NT4, 2000 and XP when only you want the XP folder. The better way would be to delete the unneeded folders from the driver search path, but you can also just remove them from this list.

Device PathWhen you have properly verified the list you should then use the "2. Save" button. This will dump the listed items into the registry so that those paths will be scanned automatically when SysPrep starts its mini-setup. You can verify that the path is correct by using regedit and browsing to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion and viewing the DevicePath value of type REG_EXPAND_SZ. It should contain all of the paths that are listed from the driver scanner in that string value.

When it's done scanning and you have saved the contents to the registry you can then exit the program by using the "3. Done" button (or from the system menu or from the upper corner x).

You should also read the section on the command-line to learn how to automate the use of this program.

Return to top.

 

Automation (Command-line Parameters / Arguments )

SPDrvScn from the Command PromptI designed the program so that it can be run from a batch file right before the computer is resealed by sysprep.exe. This means that you can completely automate its scan and that your driver database will be completely up-to-date everytime you SysPrep the computer. All that you need to do is keep the files in the driver path updated and this program will do all the manual work for you. I personally recommend that you place the SPDrvScn program executable (spdrvscn.exe) in your sysprep folder along with your other SysPrep files and add it to a batch file that executes spdrvscn.exe before sysprep.exe. I go into more detail about this later on in this section.

You can easily test the program to see if it's working from the command-line. You can run it without all of the command-line arguments except /q and it will scan the paths and import them into the registry, but it will present you with the dialogs. This way you can see the list it imports and any pop-up messages that you would normally get from the GUI.

The program syntax is:

spdrvscn [/p <search_path>] [/e <extension>] [/d <append_path>] [/p <text>] [/m <text>] [/o <text>] [/soft <path>] [/sys <path>] [/e <path>] [/x <path>] [/a] [/s] [/i] [/f] [/q] [/?]

It should be noted that anything contained in brackets is optional and that all parameters are totally independant. If the path or text following a parameter contains a space then surround that path or text in "quotation marks" (like /p "c:\program files") or it will truncate the path or text.
Parameter
Description
/p search_path
Provides the search path. If the path is a long path then surround it in quotes. This is the path that will be recursivelysearched for the files of the extension that you specify (or the default value).
/e extension
Supplies the file extension that will be used to scan. This should only be the extension and shouldn't contain and wildcards and it should not contain the leading dot.
NOTE: I provide this switch so the program is more flexible; however, I can't think of any reason not to leave this set to the default value of INF.
/d append_path
This is a path that you can supply explicitly. It is recommend that you add your Windows' INF folder (by default it is c:\windows\inf in XP). This can be a semicolon delimited list too. Also, if it contains long file names then include the entire "append_path" in quotes. It should be noted that this folder will not be scanned for validity, so be sure that you enter it correctly. Also you can use a semicolon delimited list, but normally this isn't necessary.
/f The purpose of this parameter is to append the default search path. This should almost always be added or you should manually add your inf folder. This uses the %systemroot%\inf so it will work on any drive letter and Windows folder name. This is also the default for the registry value that my program changes.
/i This will import the current DevicePath (from the registry) into the path lists. This is useful if you just want to append additional paths. This is safe though because all duplicate entries will be removed.
/m manufacturer This parameter will take the text you provide and it will update the manufacturer information in two locations so that this text will appear in the "Computer:" section of the system properties dialog. The first is in the oeminfo.ini (typically c:\windows\system32\oeminfo.ini) since this is used in Windows 2000, 2003 and XP. It will also update the HKLM\Software\Microsoft\Windows\CurrentVersion\OEMInfo "Manufacturer" value for Windows Vista, 7, 8, 2008 and 2012. If a different software hive is loaded with /SOFT this will be updated in that hive rather than in the active HKLM. I provided this feature because it is useful to know which version of your image is on a computer, and in this way you could post that information in a place that you can easily look it up when you use a computer that has your image. If this text contains a space then surround it in quotes ("manufacturer"). Also, to make this actually useful you can use variables in this text string. These are ~hour, ~minute, ~second, ~day, ~month, ~year, and ~weekday. To better understand this see the examples where /m is used. If this entry is not provided then it won't do anything, and if you want to blank this entry follow it with double quotes "".
/o duplicator This parameter will take the text you provide and it will update the OEMDuplicatorInfo information in the registry (HKLM\System\Setup\OEMDuplicatorString). If a System hive is loaded with /SYS then this will update that hive rather than the Windows HKLM\System hive. I provided this feature because it is useful to know which version of your image is on a computer, and in this way you could post that information in a place that you can easily look it up when you use a computer that has your image. If this text contains a space then surround it in quotes ("duplicator"). This registry entry is usually filled-in by SysPrep, but if you use it here instead you can make this actually useful since you can use variables in this text string. These are ~hour, ~minute, ~second, ~day, ~month, ~year, and ~weekday. It should be noted that this registry complements other registry values, the most interesting being the CloneTag entry that shows the time when the computer executed the mini-setup. To better understand this see the examples where /d is used. If this entry is not provided then it won't do anything, and if you want to blank this entry follow it with double quotes "".
/soft path
Loads the SOFTWARE registry hive from the specified location. This will must not be locked or in use, and it must exist. If this parameter is set then when saving it will save to this hive rather than HKLM. It is also used when setting the manufacturer string using /m.
/sys path
Loads the SYSTEM registry hive from the specified location. This will must not be locked or in use, and it must exist. If this parameter is set then when saving it will save to this hive rather than HKLM for setting the duplicator string with /o.
/x path
When saved the registry settings will be exported to the specified Windows Registry file - typically saved with the extension .reg.
/a
Choose to auto scan the search_path. This will auto scan the default path if you don't provide a path (c:\sysprep\drivers) and it will use the default extension (inf) if you don't provide an extension.
/s
Saves the scan information automatically on startup. You will most likely want to use /a along with this or at least use the /d option, otherwise it won't do anything.
/q
Runs in quiet mode, which basically means it quits before showing the GUI. To be useful this should be combined with /a /s, otherwise it won't serve any purpose. It should also be noted that /q will not return any errors, so if you do something silly such as run it with /s without /a then it won't tell you that it did nothing.
/x path
Runs in quiet mode, which basically means it quits before showing the GUI. To be useful this should be combined with /a /s, otherwise it won't serve any purpose. It should also be noted that /q will not return any errors, so if you do something silly such as run it with /s without /a then it won't tell you that it did nothing.
/?
This returns information on the command-line parameters. You can also see the available command-line parameters from the about box (either in the system menu or on the main page's about button).


Examples:

  1. Most Typical (Automated)
    spdrvscn /p "C:\drivers" /f /a /s /q
    Starts a scan in c:\drivers and appends the default search folder (%SystemRoot%\inf). It then saves the settings to the registry and quits. Normally this is what you want to do before shutting down the computer. You can either run it before running sysprep.exe or you can use "sysprep /quit" and then run it afterwards. Personally I use it in a startup script during the mini-setup of SysPrep, but don't worry about that if you don't know what I mean.

  2. Most Typical, Manual INF Folder
    spdrvscn /p "C:\drivers" /d "%SystemRoot%\inf" /a /s /q
    Starts a scan in c:\drivers and appends the folder %SystemRoot%\inf. It then saves the settings to the registry and quits. Normally you don't want to manually specify the INF folder. It is needed but it is easier to use /f instead.

  3. Multiple Search Folders
    spdrvscn /p "C:\drivers_reference" /p "c:\drivers_oem" /d "%SystemRoo%\inf" /d "c:\custom_driver" /a /s /q
    Starts a scan in c:\drivers_references, then adds those found in "C:\drivers_oem", appends the folder %SystemRoot%\inf and also appends c:\custom_driver. It then saves the settings to the registry and quits. Normally you will only need a single search path because you could have multiple subdirectories off a single driver folder. And normally you won't want to append multiple paths either.

  4. Multiple Appending Folders
    spdrvscn /p "C:\drivers" /d "c:\windows\inf;c:\windows\other_inf_folder" /a /s /q
    Starts a scan in c:\drivers, and then appends c:\windows\inf and c:\windows\other_inf_folder. The purpose of this example is just to show you that you can use semicolon delimited lists of paths.

  5. Standalone Program
    spdrvscn
    Just starts the program with the default settings. This is the same as running it from within Windows Explorer.

  6. Standalone Program, Changed Search Path
    spdrvscn /p "c:\drivers"
    Just starts the program, but uses c:\drivers as the search path.

  7. Searches Path But Doesn't Save
    spdrvscn /p "c:\drivers" /a
    Runs the program and searches c:\drivers for folders with drivers but doesn't save the settings automatically.

  8. Help
    spdrvscn /?
    Displays the GUI for help. This is available within the program from the Help dropdown.

  9. Autosearch and Save
    spdrvscn /a /s
    Searches the default location, which is c:\drivers, for drivers and then saves them but doesn't quit.

  10. Autosearch, Save and Quit
    spdrvscn /a /s /q
    Searches the default location, which is c:\drivers, for drivers and then saves them but also automatically quits since it doesn't show the GUI.

  11. Duplicator
    spdrvscn /o "Duplicated on ~month/~day/~year" /q
    Sets the duplicator string in HKLM\Setup and then quits.

  12. Manufacturer
    spdrvscn /m "Manufactured on ~month/~day/~year" /q
    Sets the manufacturer string in HKLM\Software and the oeminfo.ini and then quits.

  13. Manufacturer
    spdrvscn /p "c:\drivers" /x "c:\export.reg" /a /s /q
    Scans c:\drivers for drivers and then exports the files into a registry entry as c:\export.reg.

  14. Manufacturer
    spdrvscn /p "d:\drivers" /soft "d:\windows\system32\config\SOFTWARE" /a /s /q
    Scans c:\drivers for drivers and then saves the detected drivers into the offline SOFTWARE hive on the D drive.

Batch File Example:

The following script is an example of a batch file that could be used to SysPrep a computer. The example below though is not very complicated and a few things could be added to it. My personal batch file looks like this. But, it also makes use of other programs such as kill.exe (resource kit) and sync.exe (SysInternals). If you look at my batch file you will notice that I kill off all unneeded processes (including explorer.exe), stop all unneeded services, delete any temporary cache files that may have been created by the last SysPrep, terminate all SMB connections, rescan the driver structure with spdrvscn.exe, flush all files to disk and then execute the sysprep.exe file.

sysprep.bat

@ECHO OFF

ECHO SysPrep Driver Scanner with the default values supplied as arguments.
spdrvscn /p c:\sysprep\drivers /f /m "Image from ~month" /a /s /q

ECHO Command to automate SysPrep from the command-line. It is started with the start command so the command prompt window closes while SysPrep runs.
start sysprep -reseal -mini -quiet

Return to top.

 

Version History

2013/10/15: v2.1.1 released

This is a small version update that makes UAC elevation work better.

2013/10/15: v2.1.0 released

After uploading to Download.com I was given the feedback from the reviewer that it would be nice if the program could open the registry so I added the ability to open the DevicePath, Manufacturer and Duplicator strings in the registry from the Help drop-down menu. The registry doesn't support loading paths as command-line parameters so I had to write my own interface to it so let me know if you have any issues with it but it seems to work well enough.

2013/10/14: v2.0.1 released

It has been a number of years since I have released a new version but I've completely rewritten the SysPrep Driver Scanner. Now it supports both 32-bit and 64-bit Windows in a single executable. I also have added better support for Windows Vista, Windows 7 and Windows 8, but it still works great for Windows XP. I cleaned up the interface a lot, added export to CSV/Tab/Reg, implemented support for offline registry processing and gave you the ability to use Windows environmental variables (such as %SystemRoot%).

2008/01/18: 64-bit version released

I have released an experimental test version of the 64-bit version of the SysPrep Driver Scanner. I have known for a while that my old version didn't run on 64-bit Windows, but there was little I could do about it because I don't have 64-bit Windows. Someone wrote in and explained the behavior of the 64-bit version so I realized I only needed to compile a new version. Anyhow, I can't test the 64-bit version so please if you have a 64-bit version let me know if it works properly.

2007/02/23: v1.3.2 released.

This release fixes a bug when you try to update the manufacturer information in the oeminfo.ini on a installation where the Windows directory is not C:\windows (such as Windows 2000). This behavior has now been fixed.

2006/12/29: v1.3.1 released.

This releases fixes two fairly minor bugs. The first is that sometimes the column widths were not being properly set, but they should be now. The other problem was that using /f and /i after using a /q switch did not quiet the append or import behaviors. This has now been fixed.

2006/06/01: v1.3.0 released.

Added the /f and /i command-line argument options. I also added a warning when you save the registry value in non-quiet mode but forgot to append the Windows' inf folder to the list. If you find these new features useful then you can thank Clark B. because he requested them. I also added a duplicate checker to keep the list cleaner and I added a few trivial features such as a clear button.

2006/03/21: v1.2.3 released.

Yet another small bug. In some circumstances I was making an odd write to the registry for the OEMDuplicatorString. It's fixed now.

2006/02/02: v1.2.2 released.

I found another small bug. When you put it into quiet mode it wasn't shushing the success messages. That's fixed now though.

2006/01/29: v1.2.1 released.

Oops, bugs!. In version 1.2 if you used command line parameters to use the duplicator or manufacturer string and also told it to scan the driver store then it would overwrite the settings you specified on the command line. Also, I changed the variable prefix from % to ~ so as not to interfere with batch file variables.

2006/01/29: v1.2 released.

I have once again recompiled the executable, this time with Visual C++ 7.1.3088 and once again merged it with the runtime. I have made the program a little more user friendly by providing interaction with the user that lets the user know when they did something right or wrong. I fixed a few bugs and added more error handling. But, the biggest changes were with the OEMDuplicatorString string and the Manufacturer string. You can now updates these manually or automatically with the program, and you can even insert some variables to make it useful. Read the instructions above for more information on how to use them.

2005/10/06: v1.1 released.

I recompiled the executable for Visual C++ 7 and merged it with the runtime. So, it's a tad bit larger (119kB) but now it should work in more diverse situations. I haven't added any new features yet though, but I will in the next release.

2005/05/15: v1.0 released.

In future revisions I plan on adding a way to blank the registry value and to accept environment strings. At the moment if you enter a %string% on the command-line or within the program as a base search path then it won't be able to scan the path. I'll also fix any bugs that people found, but it would be a large help if they're reproducible bugs.

Return to top.

 

Download

Program Name: SysPrep Driver Scanner
Download: Vernalex.com or Download.com
Current Version: 2.1.1 (final/release)
Release Date: 2014/03/21
Notes: The program has been tested on Windows XP, Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008, Windows 8 and Windows Server 2012 (32bit and 64bit, except for Windows 2000). I would just recommend that you copy it into your sysprep folder and then create a batch file (see the previous section for details on that) and use that to kick off your sysprep procedure. Please let me know if you find this program useful, and also let me know if you have any features you would like to see in a newer version. If you find this program useful then please visit download.com and give the program a good ranking so that others will find it.

Return to top.

 

"The optimist proclaims that we live in the best of all possible worlds, and the pessimist fears this is true." --James Branch Cabell


Valid HTML 4.01! Paypal Donation Microsoft Windows Update Microsoft Office Update