Scripts, Windows

SetDevicePath – Automates the building of the DevicePath variable in registry from a specified path

Written in 2009 for the Windows versions of the time. Check that the tool or steps still suit your environment before using them.

SetDevicePath by Shaun Vermaak is a script to automatically build the DevicePath variable in registry from a specified path
. Very useful in SysPrep process (Replaces OEMPnpDriversPath in SysPrep.inf)

Publishers website: https://www.ittelligence.com
ITtelligence mirror: SetDevicePath.zip (1.09 KB)

Usage: CScript SetDevicePath.vbs /DriverFolder:PATHTODRIVERS

How to Use ItLink to this section

It searches the folder and all its subfolders, and appends every folder that contains a .inf file to the DevicePath value in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion on the local computer. Run it as an administrator.

CScript.exe //nologo SetDevicePath.vbs /DriverFolder:PATHTODRIVERS
CScript.exe //nologo SetDevicePath.vbs /DriverFolder:C:\Drivers

It prints the new DevicePath value and writes it to the registry. Folders already in the value are not added again.

Note: the whole value is written in upper case and the system drive is replaced with %SYSTEMDRIVE%, so C:\Drivers\LAN becomes %SYSTEMDRIVE%\DRIVERS\LAN. If the folder does not exist, or the parameter is missing, the script does nothing and prints nothing.

Posted on

No comments yet

Comments are moderated and appear once approved.