Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Forcing PnP Enumeration after Install

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
13 replies to this topic

#1
osborned_rcc

osborned_rcc

    MIS Support Manager

  • Member
  • 20 posts
  • Joined 15-July 05
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, 25 August 2005 - 05:54 PM.

David Osborne
Webmaster
Redlands Community College, El Reno, OK
osborned(at)redlandscc.edu
http://www.redlandscc.edu


How to remove advertisement from MSFN

#2
osborned_rcc

osborned_rcc

    MIS Support Manager

  • Member
  • 20 posts
  • Joined 15-July 05
Of course, a few minutes after I post this, I find a hopeful thread:

http://www.msfn.org/...showtopic=52741
David Osborne
Webmaster
Redlands Community College, El Reno, OK
osborned(at)redlandscc.edu
http://www.redlandscc.edu

#3
computastar

computastar
  • Member
  • 1 posts
  • Joined 07-June 05
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:

#4
schalti

schalti

    Junior

  • Member
  • Pip
  • 68 posts
  • Joined 22-July 04

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, 26 August 2005 - 01:14 PM.


#5
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 766 posts
  • Joined 03-January 04

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:

<{POST_SNAPBACK}>


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.
OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#6
osborned_rcc

osborned_rcc

    MIS Support Manager

  • Member
  • 20 posts
  • Joined 15-July 05

Thanks for the tip.
I think "devcon.exe /rescan" should also do the job.
:blushing:

<{POST_SNAPBACK}>


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, 27 August 2005 - 08:13 AM.

David Osborne
Webmaster
Redlands Community College, El Reno, OK
osborned(at)redlandscc.edu
http://www.redlandscc.edu

#7
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Member
  • PipPipPipPipPip
  • 766 posts
  • Joined 03-January 04
@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, 27 August 2005 - 09:03 AM.

OS Version = 5.1.2600 Service Pack 3
Platform ID = 2 (NT)
Service Pack = 3.0
Suite = 0x0140
Product Type = 1
Architecture = x86

#8
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 546 posts
  • Joined 30-September 05

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:

#9
p4ntb0y

p4ntb0y

    Member

  • Member
  • PipPip
  • 237 posts
  • Joined 14-February 06
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.

#10
IcemanND

IcemanND

    MSFN Junkie

  • Super Moderator
  • 3,252 posts
  • Joined 24-September 03

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/..._...09.html&hl=

#11
p4ntb0y

p4ntb0y

    Member

  • Member
  • PipPip
  • 237 posts
  • Joined 14-February 06
@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

#12
IcemanND

IcemanND

    MSFN Junkie

  • Super Moderator
  • 3,252 posts
  • Joined 24-September 03
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.

#13
p4ntb0y

p4ntb0y

    Member

  • Member
  • PipPip
  • 237 posts
  • Joined 14-February 06
@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.

#14
kickarse

kickarse

    the free techie

  • Member
  • PipPip
  • 229 posts
  • Joined 26-April 05
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, 23 May 2007 - 10:58 AM.

http://drop.io/wanderingit -- download DriverGeek (formally DriverForge) and FindHWIDS