Changing Printer Drivers En Masse



If you need to change the drivers for a large number of printers, such as on a print server, then you can use the following Powershell to do it. Set $driver to the name of the driver you wish to set and $pattern to match for the printers you wish to affect (so you don’t change the driver on printers you don’t want to).

Note: This script will run pretty quickly, but depending on the number of printers it may take upwards of 10 minutes for Windows to do all the background processing associated with the driver changes. Keep an eye out for a bunch of rundll32.exe processes which will spawn; once they close themselves down the changes should be complete.

$driver = "HP Universal Printing PCL 6 (v5.4)"
$pattern = "HP"
 
$printers = gwmi win32_printer
 
foreach($printer in $printers){
        $name = $printer.name
        if($name -match $pattern){
                & rundll32 printui.dll PrintUIEntry /Xs /n $name DriverName $driver
        }
}

9 Replies to “Changing Printer Drivers En Masse”

    1. Should be fairly easy to do; just grab your list and do something like:

      if($name -in $printerlist){
      & rundll32 printui.dll PrintUIEntry /Xs /n $name DriverName $driver
      }

      1. Would it also be possible to change all printer queues which use for example the HP Universal Printing PCL 6 (v5.4) with the HP Universal Printing PCL 6 (v6.0.0)? How would this look like?

        I am sorry, if this is a dumb question, I am not very into Powershell. Thanks up front.

  1. Oh Angry Admin, you’ve done something magic for me.

    However…

    I have a print server of appx 800 printers. We’re trying to roll up all the HP devices into a newer version of the PCL5 Universal… problem is, when the script you’ve provided (I update by driver name, not printer name) is run, it strips things such as tray assignments… Is there a way to retain all the info from the printers being updated, and update ONLY the driver itself?

    I’d really appreciate your assistance. You’ve already helped so much…

    1. The problem is that the tray assignments and the like are usually a function of the driver settings so when you switch out the driver those settings are lost. The printui.dll calls should follow the same process as changing the driver by hand, so I guess the question is if you change the driver by hand does it retain the tray assignments? If not then I think you’re out of luck, if so then it may be possible.

      1. Yeah, that answers that question… Now to attempt to pull settings, update driver, and re-set settings, possibly be .dat… Think this is feasible?

  2. Hi, I run the below on my 2012 R2 server but get nothing script executes but doesn’t change the drivers. Is there something different with 2012 R2 server?

    $driver = “HP Universal Printing PCL 6 (v6.2.1)”
    $pattern = “HP”

    $printers = gwmi win32_printer

    foreach($printer in $printers){
    $name = $printer.name
    if($name -match $pattern){
    & rundll32 printui.dll PrintUIEntry /Xs /n $name DriverName $driver
    }
    }

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.