Posted on April 29, 2014 · Posted in Windows 8

Powershell: Managing Printers and Their Drivers in Windows 8

In the previous article we have studied old school VBS scripts that can be used to manage printers and printing system in all Windows versions, starting from Windows XP. Today, we are going to consider typical commands and procedures of printer and printer driver management in Windows 8.1 / Server 2012 R2 using Powershell.

Microsoft released a new PowerShell version 4.0 simultaneously with the launch of Windows 8.1 and Windows Server 2012 R2. The new version is a part of Windows Management Framework 4.0, and has a significantly extended the list of Windows-based print server management cmdlets. You can get the full list of print, driver and print queue management cmdlets available in Posh v4 with the following command:

Get-Command –Module PrintManagement

cmdlets for manage printers with powershell in windows 8

22 cmdlets are available in Powershell:

  • Add-Printer – installs a printer
  • Add-PrinterDriver – installs a printer driver
  • Add-PrinterPort – creates a printer port
  • Get-PrintConfiguration – displays printer configuration
  • Get-Printer – displays the list of the installed printers
  • Get-PrinterDriver – displays the list of the installed drivers
  • Get-PrinterPort – displays the list of the installed printer ports
  • Get-PrinterProperty – shows printer properties
  • Get-PrintJob – shows the list of print jobs of the printer
  • Read-PrinterNfcTag – reads information about a printer from the NFC tag
  • Remove-Printer – removes a printer
  • Remove-PrinterDriver — removes a driver
  • Remove-PrinterPort – removes a printer port
  • Remove-PrintJob – removes a print job
  • Rename-Printer – renames a printer
  • Restart-PrintJob – restarts a print job
  • Resume-PrintJob – resumes a paused print job
  • Set-PrintConfiguration – sets printer configuration
  • Set-Printer – updates the printer configuration
  • Set-PrinterProperty – changes printer properties
  • Suspend-PrintJob – suspends a print job
  • Write-PrinterNfcTag – writes information into the NFC tag

To get detailed information about the syntax of any command, use the following command:

Get-Help <cmdlet_name > -Detailed

Examples of the commands:

Get-Help <cmdlet_name > -Examples

Let’s look at the typical examples of cmdlets used in printer management in Windows 8.

Let’s display the list of printer drivers in the system:


list installed print drivers with powershell

Then, install a new printer driver in the system, for example HP Universal Printing PCL 6. According to the documentation, the command to add a driver should be as follows:

Add-PrinterDriver -Name "HP Universal Printing PCL 6" -InfPath "C:\Install\HP\hpcu160u.inf"

However, when trying to install a driver this way, the following error message appears:

  Add-PrinterDriver : One or more specified parameters for this operation has an invalid value.
At line:1 char:1
+ Add-PrinterDriver -Name “HP Universal Printing PCL 6″ -InfPath “C:\Install\HP\ …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (MSFT_PrinterDriver:ROOT/StandardCimv2/MSFT_PrinterDriver) [Add-Printer
Driver], CimException
+ FullyQualifiedErrorId : HRESULT 0×80070057,Add-PrinterDriver

error then installing print driver with powershell

It turns out that the driver from the INF file can only be installed if it already exists in the DriverStore. It appears that you can’t install a driver that doesn’t exist in the DriverStore using Add-PrinterDriver command. To add a driver to the DriverStore, you can use:

  • a VBS script described in the previous article
  • the utility — pnputil.exe. The format is as follows:
     Pnputil –a pnputil.exe -i -a C:\Install\HP\hpcu160u.inf

    (installs the specific printer driver) or

    pnputil.exe -i -a C:\Install\HP\*.inf

    (installs all the drivers found in the INF files in the specified directory)

  • the cmdlet Add-WindowsDriver that allows to integrate drivers in the offline Windows image

After adding a printer driver to the DriverStore, you should install it on the printer server.

Add-PrinterDriver -Name "HP Universal Printing PCL 6"

install print driver in windows 8 with powershell

  Tip. There is some information about the «driver name» parameter. The name you specify should be equivalent to its internal system name, otherwise an error appears during the installation. You can find out the correct driver name using get-printerdriver command in the system where this driver has already been installed, or by manual check of the INF file of the driver.

Create an IP port to print using a network printer:

Add-PrinterPort -Name "IP_10.10.10.26" -PrinterHostAddress ""

We create a new printer in the system and publish (i.e. share) it using the following command:

Add-Printer -Name hp3027_Office1 -DriverName "HP LaserJet M2027 MFP PCL6 Class Driver" -PortName IP_10.10.10.26 -Shared -ShareName "hp2027_1" –Published

  Note: Note that to perform the same operation using VBS scripts (Printing Admin scripts), you should perform two different commands.

install network printer with ip port

After running these commands, a new shared printer with the name «hp3027_Office1»will appear in the system.


The printer can be removed with the command:

Remove-Printer -Name "hp2027_Office1"

Remove the driver as follows:

Remove-PrinterDriver -Name "HP Universal Printing PCL 6"
Related Articles