Adding Printers with PowerShell

 

 

Adding printers is probably best done with preferences but there may be a time when you want to do this with PowerShell. Like when you want it done now or you are working in a workgroup.

I have found two ways of doing this.

The first:

$PrinterPath = “\\servername.example.local\printer_name”
$net = new-Object -com WScript.Network
$net.AddWindowsPrinterConnection($PrinterPath)

And the second way is:

Add-Printer -ConnectionName \\printServer\printerName

NAME
Add-Printer

SYNOPSIS
Adds a printer to the specified computer.

SYNTAX
Add-Printer [-ConnectionName] <String> [-AsJob] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-Confirm]
[-WhatIf] [<CommonParameters>]

Add-Printer [-Name] <String> [-DriverName] <String> [-AsJob] [-BranchOfficeOfflineLogSizeMB <UInt32>] [-CimSession
<CimSession[]>] [-Comment <String>] [-ComputerName <String>] [-Datatype <String>] [-DisableBranchOfficeLogging]
[-KeepPrintedJobs] [-Location <String>] [-PermissionSDDL <String>] [-PrintProcessor <String>] [-Priority <UInt32>]
[-Published] [-RenderingMode <RenderingModeEnum>] [-SeparatorPageFile <String>] [-Shared] [-ShareName <String>]
[-StartTime <UInt32>] [-ThrottleLimit <Int32>] [-UntilTime <UInt32>] -PortName <String> [-Confirm] [-WhatIf]
[<CommonParameters>]

Add-Printer [-Name] <String> [-AsJob] [-BranchOfficeOfflineLogSizeMB <UInt32>] [-CimSession <CimSession[]>]
[-Comment <String>] [-ComputerName <String>] [-Datatype <String>] [-DeviceURL <String>] [-DeviceUUID <String>]
[-DisableBranchOfficeLogging] [-KeepPrintedJobs] [-Location <String>] [-PermissionSDDL <String>] [-PrintProcessor
<String>] [-Priority <UInt32>] [-Published] [-RenderingMode <RenderingModeEnum>] [-SeparatorPageFile <String>]
[-Shared] [-ShareName <String>] [-StartTime <UInt32>] [-ThrottleLimit <Int32>] [-UntilTime <UInt32>] [-Confirm]
[-WhatIf] [<CommonParameters>]
DESCRIPTION
The Add-Printer cmdlet adds a printer to a specified computer. You can add both local printers and connections to
network-based printers.

You cannot use wildcard characters with Add-Printer. You can use Add-Printer in a Windows PowerShell remoting
session.

You do not need administrator privileges to use Add-Printer.