Back to Basics – Updating Drivers – pnputil.exe vs. pnpunattend.exe

Starting with Windows Vista, Microsoft added two tools that allows for installing and updating drivers online, meaning in the running Windows operating system. The tools are pnputil.exe and pnpunattend.exe. Here is a quick guide on how they work.

TL;DR

While pnputil.exe offers more features, it sometimes fails (hangs) when updating a larger set of drivers (150-200 drivers). pnpunattend.exe is more reliable, plus a bit faster too 🙂

Updating drivers via pnputil.exe

The pnputil.exe utility, which is the more commonly known tool of the two, can do more than just updating drivers, it can also enumerate, export, and delete drivers. It also offers management control of devices such as enabling, disabling, restarting, removing, enumerating, and scanning. But, to update drivers for a machine using pnputil.exe you simply copy the drivers to a folder, for example C:\Drivers, and run the following commands:

pnputil.exe /add-driver C:\Drivers\*.inf /subdirs /install
The C:\Drivers folder

If you rather want to drive the process using a PowerShell script with some logging, you can use this script:

$DriverPath = "C:\Drivers"
$LogFile = "C:\Windows\Temp\DriverInstall.txt"
$Arguments = "pnputil /add-driver $DriverPath\*.inf /subdirs /install | Out-File -FilePath $LogFile"
Start-Process -FilePath PowerShell.exe -ArgumentList $Arguments -Wait

Updating drivers via pnpunattend.exe

The pnpunattend.exe utility allow you to either audit a machine for drivers or perform driver installations. This utility works a bit different than pnputil.exe in that you use a registry setting to specify the path to the drivers. The registry key is HKLM\Software\Microsoft\Windows NT\CurrentVersion\PnPUnattend\DriverPaths\1, and then you create a string value named Path and set its data to the actual path, for example C:\Drivers. Here is a short PowerShell snippet the creates the keys and value.

$DriverPath = "C:\Drivers"
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\UnattendSettings\PnPUnattend\DriverPaths" -Name 1 -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\UnattendSettings\PnPUnattend\DriverPaths\1" -Name Path -Value $DriverPath -Force

Now, if you want to search for drivers without actually installing them you run this command:

pnpunattend.exe auditsystem /s /l
Running pnpunattend.exe without installing the drivers

To install the drivers, you skip the /s switch, and run this command:

pnpunattend.exe auditsystem /l
Installing drivers via pnpunattend.exe
About the author

Johan Arwidmark

5 2 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

>