PnP Driver install
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
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
[ + ] Show comments
Answers (5)
Please log in to answer
Posted by:
AngelD
16 years ago
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.
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.
Posted by:
kiptek
16 years ago
i think he meant get it added to this "template".... http://itninja.com/question/gnu,-freeware-and-shareware-programs-to-cloning596
Posted by:
AngelD
16 years ago
Posted by:
philhall
15 years ago
Posted by:
turbokitty
15 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.