Automatically Update Drivers?

Hey everyone,

I need help looking for the solution to what I fear is a rare problem. Since nowadays people generally inject drivers when capturing a windows image, there is generally not a need for the script I’m trying to create. However in this case, I need to update drivers for multiple machines, with differing models, but the driver packages are downloaded to a folder that is on all of these machines. By hand, I would generally go to the device manager, Right click on the drivers that need to be updated, browse my computer for the driver software, and point to the folder. Windows would then of course search the folder for the driver files, and automatically update them for me. Is there anyway I can script that functionality?

I think this command is a step in the right direction because it tell mes which drivers are “broken”
Get-WmiObject Win32_PNPEntity | Where-Object{$_.ConfigManagerErrorCode -ne 0} | Select Name, DeviceID

Please let me know if you all have any ideas on how to script this functionality.

Vincent Morris

You can use pnputil.exe with the -a parameter for that. You don’t even really need to try to figure out which drivers to install; just do them all, and let Windows figure it out. Something like this:

Get-ChildItem C:\Drivers -Recurse -Include *.inf |
ForEach-Object {
    pnputil.exe -a $_.FullName

Is there a way to surpass the Windows security message for unsigned drivers?

Not that I’m aware of, unless you modify your security settings so it just installs unsigned drivers without prompting. That’s a security thing; you have to decide how easy you want it to be for unsigned, potentially malicious code to be installed.

Well whats weird is I downloaded these drivers from the Dell and Lenovo sites, I’m not sure why they are considered unsigned. Darn, I was hopping I would be able to pass a -Force or /Quiet but that didn’t work. I will have to temporarily disable the security setting. Thanks for your help!