Create a powershell command that installs every driver recursively in the current…
- User
Create a powershell command that installs every driver recursively in the current directory on windows
- Assistant
Create a powershell command that installs every driver recursively in the current directory on windows
To install every driver recursively in the current directory and its subdirectories on Windows using PowerShell, you can utilize the PnPUtil utility. PnPUtil is a command-line tool that allows you to manage the driver store and install driver packages.
Here is the PowerShell command that accomplishes this:
pnputil.exe /add-driver ".\*.inf" /subdirs /install
pnputil.exe: Calls the PnPUtil utility./add-driver ".\*.inf": Specifies to add all driver packages (*.inf files) in the current directory./subdirs: Includes all subdirectories when searching for driver packages./install: Installs the driver packages after they are added to the driver store.Open PowerShell with Administrative Privileges:
PowerShell.Navigate to the Target Directory:
Use the cd command to navigate to the directory containing your drivers.
cd "C:\Path\To\Your\Drivers"
Run the Command:
Execute the following command to install all drivers recursively:
pnputil.exe /add-driver ".\*.inf" /subdirs /install
.inf files, which are the setup information files used for driver installation.pnputil.exe /enum-drivers.Upon running the command, you should see output similar to:
Microsoft PnP Utility
Adding driver package: C:\Path\To\Your\Drivers\Driver1.inf
Driver package added successfully.
Published Name: oem1.inf
Driver package installed on matching devices.
Adding driver package: C:\Path\To\Your\Drivers\Subfolder\Driver2.inf
Driver package added successfully.
Published Name: oem2.inf
Driver package installed on matching devices.
Total driver packages: 2
By using the above command, you can efficiently install all necessary drivers in your directory structure, which is especially useful for automated deployments or setting up new systems.
Not yet included in a published release.