Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


osborned_rcc

Forcing PnP Enumeration after Install

14 posts in this topic

What I'm trying to do is to minimize coding time, by running SetupCopyOEMInf.exe AFTER setup, then somehow forcing PnP enumeration again. This is because if I run SetupCopyOEMInf.exe after install, the drivers for the "unknown" devices are there, they're just not loaded until I run the Update Hardware Wizard. Is there a program out there that runs auto-update on all devices, or re-runs PnP discovery? The closest thing I've found out there might be the sysprep tool, using the -pnp argument, but it seems it's really a tool for imaging rather than a general tool, and I'm unsure what it might do if I call it in my cleanup file. The -pnp argument forces PnP discovery after a reboot, but then I don't know what else it's supposed to do.

My idea here is that I don't bother using Winnt.sif to find drivers, keep my drivers on CD, run SetupCopyOEMInf.exe against the drivers on the CD, then force PnP discovery to setup the new drivers. After this, the cleanup.cmd file performs a reboot and voila, all drivers are installed. I'm not worried about leaving the drivers on the hard drive as I'm setting up stock Dell PC's for labs and offices.

Any other ideas?

Edited by osborned_rcc
0

Share this post


Link to post
Share on other sites

Hi osborned_rcc,

I've been following the forum for a while now, and got some very useful information from it, so its about time I gave something back.

I to use a similar method to the SetupCopyOEMInf.exe way, so like yourself was looking for a way to autorun rescan hardware. After much investigating I discovered the way that sysprep calls -pnp or the UpdateInstalledDriver key in Sysprep.inf. Sysprep uses many api calls that are in syssetup.dll, one of these call is UpdatePnpDeviceDrivers, so you can call this from a command line as shown below:

RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers

You could use this in batch file or vbscript. You need to be careful with the case. It has to be as above or it will fail.

Hope the helps.

Computastar :hello:

0

Share this post


Link to post
Share on other sites
Hi osborned_rcc,

I've been following the forum for a while now, and got some very useful information from it, so its about time I gave something back.

I to use a similar method to the SetupCopyOEMInf.exe way, so like yourself was looking for a way to autorun rescan hardware. After much investigating I discovered the way that sysprep calls -pnp or the UpdateInstalledDriver key in Sysprep.inf. Sysprep uses many api calls that are in syssetup.dll, one of these call is UpdatePnpDeviceDrivers, so you can call this from a command line as shown below:

RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers

You could use this in batch file or vbscript. You need to be careful with the case. It has to be as above or it will fail.

Thanks for the tip.

I think "devcon.exe /rescan" should also do the job.

:blushing:

Edited by schalti
0

Share this post


Link to post
Share on other sites
Hi osborned_rcc,

I've been following the forum for a while now, and got some very useful information from it, so its about time I gave something back.

I to use a similar method to the SetupCopyOEMInf.exe way, so like yourself was looking for a way to autorun rescan hardware. After much investigating I discovered the way that sysprep calls -pnp or the UpdateInstalledDriver key in Sysprep.inf. Sysprep uses many api calls that are in syssetup.dll, one of these call is UpdatePnpDeviceDrivers, so you can call this from a command line as shown below:

RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers

You could use this in batch file or vbscript. You need to be careful with the case. It has to be as above or it will fail.

Hope the helps.

Computastar :hello:

Welcome to MSFN forums. I see it's your first post here and i would like to thanks you joining us for posting this info. Long time ago, i was googling to find an alternative to DEVCON command line (no GUI) or devmgmt.msc (not really unattended :angry: ) and never find the answer. Now i've got one answer i can use for some of my batch scripts as linked by osborned_rcc.

0

Share this post


Link to post
Share on other sites
Thanks for the tip.

I think "devcon.exe /rescan" should also do the job.

:blushing:

I'm not sure about that, as taking a look at the explanation for that switch says it simply runs "Scan for New Hardware", and doing that manually in Device Manager after integrating drivers never worked. What Bilou's code seems to do is to force Device Manager to force each unknown device to be rescanned. "Scan for New Hardware" shouldn't do anything, as the hardware's already been FOUND, it just hadn't been installed. I've tried Bilou's code and it works fine. I simply put it in my cleanup file and don't worry about messing with AutoIt scripts in a DetachedProgram or anything, it's just taken care of. The setup process is a bit slower, but it works, so I don't care if it's not pretty. Bilou's code presents a great simple way to dynamically integrate drivers.

Edited by osborned_rcc
0

Share this post


Link to post
Share on other sites

@shalti

I think osborned_rcc is right.

DEVCON RESCAN works in my batch file because i first delete infos about device in registry with:

DEVCON REMOVE

This command is equivalent to devmgmt.msc (Device Manager), click on the device, right click, Uninstall

DEVCON RESCAN

Scan for hardware changes

works for new devices not already detected.

command1

RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers

is same as

command2

DEVCON updateni <inf> <hwid>

This command is equivalent to devmgmt.msc (Device Manager), click on the device, right click, Update Drivers...

command1 updates all devices instead of only the one specified with hwid

infs files have to be integrated first with Pyron's SetupCopyOEMInf.exe

command2 uses specified inf file and update only specified hwid

Edited by Bilou_Gateux
0

Share this post


Link to post
Share on other sites
Sysprep uses many api calls that are in syssetup.dll, one of these call is UpdatePnpDeviceDrivers, so you can call this from a command line as shown below:

RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers

You could use this in batch file or vbscript. You need to be careful with the case. It has to be as above or it will fail.

Thanks for this, but where does Windows look for the drivers if you run this command?

Is there any way to append a path to the drivers to this command?

Example:

RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers "%SystemDrive%\driver_temp\"

:unsure:

0

Share this post


Link to post
Share on other sites

forgive me for being a bit thick but I am I right in thinking that....

if windows starts up and it knows the device name but does not know the path to the Device driver then all you need to do is run -pnp?

I have a situation were most of my drivers load on sysprep but some pop up asking for the location I then click find automacticallly and then it loads fine sometimes I have to click continue anyways when no cat file exists.

if this is totally unrelated I start a different post.

0

Share this post


Link to post
Share on other sites
Thanks for this, but where does Windows look for the drivers if you run this command?

It will use the path listing from the registry in HKLM\software\microsoft\currentversion\devicepath

by default this is set to only look ing %systemroot%\inf, but if you have added paths via winnt.sif or sysprep.inf, or other answer files or methods you may have more.

@pantboy - how are you adding the paths to your drivers? And have you turned off the driver signing policy?

Running sysprep -pnp will still reseal the machine, if all you need to do is have windows research for drivers then

RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers should do the trick.

or check this topic out:

http://www.msfn.org/board/Drivers_CD_Path_...09.html&hl=

0

Share this post


Link to post
Share on other sites

@iceman

I have tried via Unatted and sysprep which I know just updates the reg device path as you mentioned.

Driver signing is off via the sysprep.inf

I have taken out oempnpdrvierspath in sysprep as I now use sysprep driver scanning (top tool)

This does the following....

flush data to disks

delets old driver caches

creates driver paths for devicepath reg value

close smb connections

Terminate'sunneeded processes

Stop's unnessary services

Remove's cached OEM drivers

clear event logs

flush data to disks

and then finally

start sysprep -reseal -mini -quiet

I dont use -pnp as I was told that this adds additional time to boot.

As I do not fully inderstand the -pnp and the way these drivers behave I Thought I post in this topic, I dont however want to to be flamed to death for hijacking someone's post if its not related I start a new one.

Like I said before all my hardware works fine except the NC6400 (its a laptop by the way) its knows the name of the device and the reg value is correct, driversiging is set to ignore however up pops the prompt box I click find automacitally and then it loads up fine. Some driver's require the "continue anyway" click and others don't (I am I right in thinking that those that require "continue anyway" dont have a cat file)

Its a bit strange as I dont fully understand the whole in depth preocess

0

Share this post


Link to post
Share on other sites

if you are already running sysprerp try adding the -pnp switch. it only adds about a minute to the startup time.

Also have you added 'UpdateInstalledDrivers=Yes to the Unattended section of your sysprep.inf? That is needed for installing unsigned drivers in my experience.

0

Share this post


Link to post
Share on other sites

@iceman

Yeah I have the updatedrivers set to yes

I will add the -pnp into my sysprep and test it.

I got 25 different models running just fine. I need to sort this out as a temp solution untill I have finished the BDD 2005 and SMS OSD FP and then all i do for drivers is a wmi call to the model from the bios and then update the drivers in my wim automatically works nice but maybe can work better with some of the great tools in this forum.

0

Share this post


Link to post
Share on other sites

Try this out guys...

Using WatchDriverSigningPolicy.exe and Vernalex Sysprep Driver Scanner I've been able to come up with a batch script to do something similar to your program. Make sure that they are all in the same directory. I used c:\d for the drivers locations (bashrats driverpacks).

Basically it turn off Driver Signing using Pyrons method, then imports drivers into the registry, then start Device Manager so you can see what's happening, then it starts the install of the devices. Once install finishes it closes out WatchDriverSigningPolicy and the Device Manager (mmc.exe).

@ECHO OFF
ECHO Setting Driver Signing Policy to OFF
START WatchDriverSigningPolicy.exe
ECHO Importing Drivers to Registry
START /WAIT spdrvscn /p c:\D /e inf /d %windir%\inf /a /s /q
ECHO Starting Driver Manager
START devmgmt.msc
ECHO Starting Install of Hardware
START /WAIT RunDll32.exe Syssetup.dll,UpdatePnpDeviceDrivers
taskkill /f /im WatchDriverSigningPolicy.exe
taskkill /f /im mmc.exe

Edited by kickarse
0

Share this post


Link to post
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.