Skip to content

PowerShell add printer builder

Add a printer with PowerShell

Type the printer's IP address, or its print server and share, and get one script for Windows 10 or 11 that adds the port, the driver and the printer, sets double-sided and black and white, and the line that takes it off again. It runs in your browser: nothing you type is sent to us.

Copy Room Colour at 10.20.1.22, double-sided black and white on Letter, is an example. Change it to your printer.

Add it

Straight to the printer on the network, with a driver on this computer.

Sides by default
Also

Paste this in PowerShell

Search Start for PowerShell, right-click it and choose Run as administrator, then paste the whole script.

The script, 5 lines
if (-not (Get-PrinterPort -Name 'IP_10.20.1.22' -ErrorAction SilentlyContinue)) { Add-PrinterPort -Name 'IP_10.20.1.22' -PrinterHostAddress '10.20.1.22' -PortNumber 9100 }
Add-PrinterDriver -Name 'Microsoft PCL6 Class Driver'
Add-Printer -Name 'Copy Room Colour' -DriverName 'Microsoft PCL6 Class Driver' -PortName 'IP_10.20.1.22'
Set-PrintConfiguration -PrinterName 'Copy Room Colour' -DuplexingMode TwoSidedLongEdge -Color $false -PaperSize Letter
Get-Printer -Name 'Copy Room Colour' | Format-List Name,DriverName,PortName,PrinterStatus
  1. 1A standard TCP/IP port to 10.20.1.22 on port 9100, named the way Windows names it, unless it is there already.
  2. 2Installs a class driver that comes with Windows: it prints, but without the model's finishing options.
  3. 3Adds Copy Room Colour on that port. It is on this computer for everyone who signs in.
  4. 4Prints double-sided on the long edge, black and white, on Letter unless someone picks otherwise in the print dialog. The printer needs a duplex unit for two-sided.
  5. 5Shows the printer, its driver and port, to check it worked.

To take it off, and other ways in

  • The undo

    Remove-Printer -Name 'Copy Room Colour'; Remove-PrinterPort -Name 'IP_10.20.1.22'

    Takes the printer and its port off again.

What each cmdlet does

All of them come with Windows 10 and 11, in the PrintManagement module. The IP route prints to the printer's port 9100; the server route goes through a print server, which hands each computer the driver.

PowerShell printer cmdlets and what each does
CmdletWhat it does
Add-PrinterPortMakes a standard TCP/IP port: the printer's address and port 9100. -PrinterHostAddress takes an IP address or a hostname.
Add-PrinterDriverInstalls a driver that is already in the Windows driver store. It does not download one.
Add-PrinterJoins a name, a driver and a port into a printer. With -ConnectionName it connects to a shared printer on a server instead.
Set-PrintConfigurationSets the printer's defaults: -DuplexingMode, -Color and -PaperSize. People can still change them in the print dialog.
Get-PrinterLists printers. Get-Printer | Format-Table Name,DriverName,PortName shows what is there now.
Remove-PrinterTakes a printer off. Remove-PrinterPort then removes its port, once nothing uses it.

Which driver?

A print driver turns the page into the printer's language. The Microsoft class drivers come with Windows and print plain jobs; the model's own driver adds its trays, staples and hole punch. A job that will not leave afterwards is cleared with the print queue clear command.

  • PCL6 or PS class

    Most office copiers take PCL; pick PS for one that only speaks PostScript.

  • The model's driver

    Unzip the maker's download, run pnputil /add-driver with its .inf file and /install, then use its exact name.

  • Exact names

    Get-PrinterDriver lists the drivers installed, by the name Add-Printer needs.

  • The default printer

    Windows 11 moves the default to the last one used unless Let Windows manage my default printer is off.

Add the printer once, for every teacher.

This script adds one printer to one computer. In KyberCopy the copy room adds each printer once, the relay reads what it can do over IPP, and teachers send from the request form without a driver or a script on their laptop.

Book a demo