Jump to content

Scripts To Install Drivers For Unattended And Sysprep


Necros

Recommended Posts

Hi all !

I'm about testing a couple of little php script using devcon.exe and pnpids.exe.

One script associates PnPID to the inf file describing a driver, and the second script uses the previously build database (CSV format) to update drivers if a compatible hardware exists on the system.

I coded these scripts quickly and if you thinks they are useful, I may enhance them to build an online database. (after a much proper re-coding)

Downloads available at the end of this post

My work is intended to make easier unattended driver setup, without hacking windows setup, and without using registry (directly or indirectly) to store driver path. I think using devcon.exe to update device drivers and pnpids.exe are the best way to respect the windows internal procedure.

Features planned:

-Automatic creation of a file containing [sysprepMassStorage]

-easy to maintain method for both unattended setup and master image management with sysprep

-Maintaining an online database with data about each PnPID (sometimes I find unknown hardware and I must search for a manufacturer without having his name)

-specific hardware handling: nvidia ethernet adapter are not defined with a PnP ID in inf files (I found a DOS batch file with a workaround; an other workarond is needed to Hercules fortissimo drivers too) :(

Overview of csv file created by the first script

PCI\VEN_1069&DEV_0050&SUBSYS_00541069;D:\Multi_dvd\sysprep\drivers\04_controller\Mylex LSI Logic\AcceleRAID 160, 170, 352, ExtremeRAID 2000, 3000\2K\ar160.inf
PCI\VEN_1069&DEV_0050&SUBSYS_00521069;D:\Multi_dvd\sysprep\drivers\04_controller\Mylex LSI Logic\AcceleRAID 160, 170, 352, ExtremeRAID 2000, 3000\2K\ar170.inf
PCI\VEN_1069&DEV_0050&SUBSYS_00501069;D:\Multi_dvd\sysprep\drivers\04_controller\Mylex LSI Logic\AcceleRAID 160, 170, 352, ExtremeRAID 2000, 3000\2K\ar352.inf
PCI\VEN_1069&DEV_BA56&SUBSYS_00401069;D:\Multi_dvd\sysprep\drivers\04_controller\Mylex LSI Logic\AcceleRAID 160, 170, 352, ExtremeRAID 2000, 3000\2K\exr2000.inf
PCI\VEN_1069&DEV_BA56&SUBSYS_00301069;D:\Multi_dvd\sysprep\drivers\04_controller\Mylex LSI Logic\AcceleRAID 160, 170, 352, ExtremeRAID 2000, 3000\2K\exr3000.inf
PCI\VEN_1095&DEV_3112&SUBSYS_31121095;D:\Multi_dvd\sysprep\drivers\04_controller\Silicon Image\sil 3112\SI3112.inf
PCI\VEN_1095&DEV_3112&SUBSYS_34238086;D:\Multi_dvd\sysprep\drivers\04_controller\Silicon Image\sil 3112\SI3112.inf
PCI\VEN_1095&DEV_3112&SUBSYS_311215D9;D:\Multi_dvd\sysprep\drivers\04_controller\Silicon Image\sil 3112\SI3112.inf
PCI\VEN_1095&DEV_3112&SUBSYS_B0021458;D:\Multi_dvd\sysprep\drivers\04_controller\Silicon Image\sil 3112\SI3112.inf

To use these scripts you need php 5.1.2; use it as a command line script interpreter http://www.php.net

I tried to run with success php interpreter in a folder containing only php.exe and php5ts.dll (without any path pointing to the full version of php in the %path% environment variable)

To download devcon.exe goto http://support.microsoft.com/kb/311272

To get Sysprep 1.1 for windows 2000 http://www.microsoft.com/downloads/details...;displaylang=en

For windows XP find deploy.cab in your original XP cdrom.

update your environment variable %path% to your php interpreter

create a folder (anywhere you want) containing devcon.exe and pnpids.exe

download into this folder the php scripts

to fill the csv file used as database open a command prompt and type php -f "driver detect.php" <Driver_Collection>

<Driver_Collection> is a path to a folder containing a driver pack. each subfolder is scanned for inf file. Each inf file is read with pnpids.exe.

To update your system open a command prompt and type php -f "driver install.php"

If a hardware PnPID is detected in both your computer and the csv file, devcon.exe will update your driver.

I will test my work on several computers deployed with sysprep, unattended installations with either drivers from CD or drivers from a network share

success:

CSV generation from a folder with few mass storage drivers, and chipset drivers from NVidia, SiS, ALI

hardware detection and installation on a scsi card

Test to do:

-CSV generation from a huge drivers collection (never used Bâshrat the Sneaky's driver pack, but I think it will work)

-device detection and installation on a "driverless" windows (clean install) (need your help guy because there are so many different configuration !) (tests runnings with SiS drivers)

HISTORY

Added support for partial PnP ID comparison, need manual csv edit (automatic handling of this case planned)

Little bugfix in driver install.php

Added several drivers install for a single hardware instance (experimental) (I wish the most up to date driver on the host system)

Downloads:

Driver_Detect.php

Driver_Install.php

Edited by Necros
Link to comment
Share on other sites


@IcemanND you're right.... but I stopped programming with VB long ago.

I made a little batch file to launch my php scripts, now I have to add "driver install.php" in runonce during windows setup. I may launch it directly a T-13 step; but converting into VB may fail if VB scripting components are not already available.

I have to try php.exe alone, without any extension or other stuff. If this works, then I will have something similar to AutoIt.

I may also code with php4 and use a software to "compile" the script into a single executable containing both php.exe and my script

Edited by Necros
Link to comment
Share on other sites

I'm thinking about drivers packed in a installer software (AND chipset, and ATI + Nvidia video drivers).

I have to code a new feature able to detect pnp ID from a specified INF file and add a commandline to start a specific installer with the silent option.

@all

Did you try installing nvidia drivers from a inf file ? Are Nvidia softwares correctly installed and working (nvidia audio and video especially)

I tried to install SiS chipset drivers. I found these issues:

ISSUE 1

=====

- hardware PnP ID for SiS IDE and AGP controllers in .inf files are not telling SubSys part

PCI\VEN_1039&DEV_5513;f:\drivers\01_chipset\SiS\95 98 Me NT 2K XP 2003 XP-64 2003-64\R204a\IDE\win2k\SISIDE.INF

PCI\VEN_1039&DEV_0001;f:\drivers\01_chipset\SiS\95 98 Me NT 2K XP 2003 XP-64 2003-64\agp121\AGP\current\WIN2000\sisagp.inf

I added a third column in the database to ignore SubSys ID when comparing the current line from database with a PnP ID found in the host computer.

PCI\VEN_1039&DEV_5513;f:\drivers\01_chipset\SiS\95 98 Me NT 2K XP 2003 XP-64 2003-64\R204a\IDE\win2k\SISIDE.INF;no_subsys

PCI\VEN_1039&DEV_0001;f:\drivers\01_chipset\SiS\95 98 Me NT 2K XP 2003 XP-64 2003-64\agp121\AGP\current\WIN2000\sisagp.inf;no_subsys

I don't know if devcon may report a hardware PnP ID without SubSys part. I suppose that will never happen.

I added the third column by hands.

I will suppress this column by checking each PnP ID for SubSys ID, If not present, then trim SubSys ID from the detected PnP ID before comparison.

ISSUE 2

=====

devcon may enforce installation of a driver designed for windows XP on windows 2000. With the IDE driver, a prompt appeared because the driver is not signed. The AGP driver is installed silently, but the computer cannot reboot properly (I had to go back to the last good known configuration)

I have to find how to detect each compatible windows for a given INF file, or specify for each .inf file which windows are compatible.

Edited by Necros
Link to comment
Share on other sites

There's a utility that will create a verification of the drivers for you

http://www.updatexp.com/sigverif-exe.html

http://support.microsoft.com/kb/308514

Also I think there's a registry hack that will allow unsigned drivers

There's a program that when run will allow installation of unsigned drivers. It's called WatchDriverSigningPolicy.exe .

http://www.msfn.org/board/lofiversion/index.php/t57463.html

http://unattended.msfn.org/unattended.xp/view/web/35/

Edited by kickarse
Link to comment
Share on other sites

@kickarse

Hi,

I may use REG.EXE to set driver signing policy to ignore and restore it's previous state. I think that's the best way. WatchDriverSigningPolicy is intended to be used with unattended setup, and you're right, I may need it when installing drivers a T-13 step.

sigverif.exe is intended to be used to check if a driver has been signed or not. I may use it with a wish to install only signed drivers. However, I don't know how to detect if a driver has been designed for a specific windows version.

Driver install.php installed yesterday a SiS AGP driver for windows XP on Windows 2K. I expected windows 2K refuse to install it anyway. :(

@all

I need to find a workaround to detect which windows a driver is designed for...

I keep this issue open, If we find a suitable workaround for both win 9x and 2K and later systems...

Edited by Necros
Link to comment
Share on other sites

  • 1 month later...

@all

Hi,

many time elapsed since my last post. I dont' have any tool to ensure windows installs the most appropriate driver. I'd like to try hwphp http://www.paraglidernc.com/HWPnP.html but all my attempts to install a device driver with this tool failed.

Maybe I don't understand how it works. :s

Can an bartPE expert coud explain how to install a driver with this tool, from the command line ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...