What is Add-PrinterDriver actually used for?

As of Windows 8.1 / Server 2012 R2 there is one beautiful cmdlet -Add-PrinterDriver. It dramatically simplifies driver/printer installation.

Naturally you will be tempted to install a driver from an .inf file like this:

But you will be blamed:

So it does not work as you/we may think. Sigh… So then what it is used for?

The documentation of Add-PrinterDriver is not very clear. It just says:

Installs a printer driver on the specified computer

Syntax:

Add-PrinterDriver [-Name] <String> [[-InfPath] <String> ]

Hmm…isn’t strange that you can specify name and *eventually* path to the inf file?

Here is the catch: the driver package should already be present in Windows’ driver store!So let’s re-read the docs again:

+++++++++++++++++++++++++++++++++++++++++++++++++

Add-PrinterDriver:Installs a printer driver [from the driver store] on the specified computer.

Arguments:

-Name:Specifies the name of the printer driver [as seen in the driver store].
-InfPath:Specifies the path to the printer driver INF file in the driver store.

+++++++++++++++++++++++++++++++++++++++++++++++++

Now that makes sense, right?

The Driver store is something like a repository for drivers. Actual installation gets the required files from Driver store, place them according to the installation rules (usually in System32\Drivers) and performs driver registration (in the registry).

So the next question is how do we actually add a printer driver package to the Driver store?

The answer is simple – use the built in PNPUTIL tool:

So the workflow for installing a printer with its driver will be:

  1. Add printer’s driver in the Driver store
  2. Install the printer

Some tips:

  • Add-PrinterDriver interncally usesMSFT_PrinterDriver::Add().
  • If your drivers are located on a shared folder (i.e. using UNC path) your script may encounter the security pop-up (aka Attachment Manager’s warning). You can overcome this by temporarily settingSEE_MASK_NOZONECHECKS environment variable to value “1” (without quotes) then add printer drivers.

Additional links:

  1. Powershell: Managing Printers and Their Drivers in Windows 8
  2. Add-PrinterDriver to remote servers
  3. Install Printer Drivers with PowerShell in Windows 8

Leave a Reply

Your email address will not be published. Required fields are marked *

*