Using PowerShell to install a network printer

by Mitch Tulloch [Published on 21 Nov. 2014 / Last Updated on 21 Nov. 2014]

A tip on how to use Windows PowerShell to install a network printer.

Installing a new network printer using Windows PowerShell involves performing the following steps:

  1. Installing a printer driver for the new printer

  2. Creating a Standard TCP/IP Port for the printer

  3. Installing the printer using the driver and port specified

  4. Performing any additional configuration needed for the printer

For example, let’s say you want to install a printer that uses the Dell Color Laser PCL6 Class Driver on your print server. You could begin by using the Add-PrinterDriver cmdlet to install the printer driver on the server:

PS C:\> Add-PrinterDriver -ComputerName HOST7 -Name "Dell Color Laser PCL6 Class Driver"

Next, you could use the Add-PrinterPort cmdlet to add a new port for the printer like this:

PS C:\> Add-PrinterPort -ComputerName HOST7 -Name "172.16.11.63" `
-PrinterHostAddress "172.16.11.63"

Next, you could use the Add-Printer cmdlet to install, name, and share the new printer using the driver and port previously specified as follows:

PS C:\> Add-Printer -ComputerName HOST7 -Name "Sales Printer" `
-DriverName "Dell Color Laser PCL6 Class Driver" -Shared `
-ShareName "SalesPrint" -PortName "172.16.11.63"

Finally, you might want to change the default paper size for the new printer from Letter to Legal like this:

PS C:\> Set-PrintConfiguration -ComputerName HOST7 -PrinterName "Sales Printer" `
-PaperSize Legal

The above tip was excerpted from Mitch Tulloch's book Training Guide: Installing and Configuring Windows Server 2012 from Microsoft Press.

Mitch is a nine-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows administration, deployment and virtualization.  For more information see http://www.mtit.com.

See Also


The Author — Mitch Tulloch

Mitch Tulloch is a well-known expert on Windows Server administration and cloud computing technologies. He has published over a thousand articles on information technology topics and has written, contributed to or been series editor for over 50 books.