Here is a fairly simple method to add drivers to the computers PnP list. If someone has the ability could this be added to the PNP Driver Install Template?

The sticky thread "PNP Driver Install Template" is not very useful unless you use Wise installer. I finally gave up on the whole msi thing and started looking in other areas. Here is what I found, pretty simple solution using a VBscript on startup. All that is needed is the driver files copied to the computer (I put them in C:\windows\inf\) and the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ String Value = "DevicePath" appended to have the path to this folder. Restart and windows will automatically create a new .pnf for this driver and install the device automatically when it is plugged in.

Here's the script:

Option Explicit
On Error Resume Next
set oshell=wscript.createobject("wscript.shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists("C:\WINDOWS\inf\WPC100") then
objFSO.CopyFolder "\\networkshare\WPC100","C:\WINDOWS\inf\WPC100",True
end if

Dim oShell, keyToPlayWith, oldKeyVal, newKeyVal, stringToAppend, finalReadToTest

keyToPlayWith = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath"
stringToAppend = "C:\windows\inf\wpc100;"
oldKeyVal = oShell.RegRead(keyToPlayWith)
IF InStr(oldKeyVal,stringToAppend) = 0 THEN
newKeyVal = oldKeyVal & stringToAppend

oShell.RegWrite keyToPlayWith,newKeyVal,"REG_EXPAND_SZ"

finalReadToTest = oShell.RegRead(keyToPlayWith)

if finalReadToTest = newKeyVal
end if
0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


If I recall the DevicePath has a length limit so you may watch out for that.

To add this to a template just copy the standard one and add it as a custom action. You may need to add some code to get the directory path from a property or similar.
Remove any "wscript." from the script for it to work as a vbscript custom action in deferred execution.

Also you need to have the files installed by the package as the system context (deferred) does not have access to the network.
Answered 08/05/2008 by: AngelD
Red Belt

Please log in to comment
i think he meant get it added to this "template".... http://itninja.com/question/gnu,-freeware-and-shareware-programs-to-cloning596
Answered 08/05/2008 by: kiptek
Second Degree Green Belt

Please log in to comment
You're right kiptek, I didn't read his post carefully.
However it is all described in the "Plug and Play driver Installation Explained" link in the sticky as that is how the template was created.
Answered 08/05/2008 by: AngelD
Red Belt

Please log in to comment
If you add the driver files to a folder already in the devicepath then you don't need to reboot.

I've tested this successfully with a pcmcia card, I assume this works for USB as well?

Does anyone know if it works for unsigned drivers?
Answered 02/11/2009 by: philhall
Yellow Belt

Please log in to comment
I think there's a dead link in that sticky.

Has anyone tried using the new WDK?
Answered 02/11/2009 by: turbokitty
Sixth Degree Black Belt

Please log in to comment