Change Printer driver with powershell

Hey guys!
I’m trying to change the driver in one of our printers (150 clients)… It not going to well I most admit.

OS = Windows 7 x64
PS version = 2.0


I trying with these commands:
Step 1. Import the new driver:
pnputil -a C:\Users\root\Desktop\HPM400_drivers*.inf <-- that seems to work
Output from command:

Microsoft PnP Utility

Processing inf : hpbuio35l.inf
Driver package added successfully.
Published name : oem13.inf

Processing inf : hpcm401c.inf
Driver package added successfully.
Published name : oem14.inf

Processing inf : hpcm401u.inf
Driver package added successfully.
Published name : oem15.inf

Total attempted: 3
Number successfully imported: 3

So now when the driver is imported I most change the current printer driver of the printer “printer1” to the newly imported.
Tried the following commmand:

& rundll32 printui.dll PrintUIEntry /Xs /n “printer1” DriverName “drivername”

This gives me an error of: “…Windows could cannot locate the suitable driver…”

Then I thought I could export the configuration from a allready configured printer with the right driver… and then Import the settings on another computer…

Try 2:

Client1 export the configuration:
& rundll32 printui.dll PrintUIEntry /Ss /n “printer1” /a “printer1.dat”

Client2 Import the configuration:
& rundll32 printui.dll PrintUIEntry /Sr /n “printer1” /a “printer1.dat”

No luck here either. Export = ok import = fail

…and yes, I imported the new driver before I did the import of the configuration.

Any ideas of another solution I should use?

Best regard
Cristopher Hermansson

Check out the VBScripts in c:\windows\system32\Printing_Admin_Scripts\en-US\ . Use prndrvr.vbs to install the driver, then prncnfg.vbs to modify the properties of an existing printer (or prnmngr.vbs to create a new one).

You can either call the scripts from your PowerShell script (using cscript.exe), or you can rewrite them in PowerShell if you’d like; they do all the work using WMI.

Thanks! Will check this out!

Ended with that I removed the printer and added it againt. Didn’t managed to just switch the printer driver.