PowerShell provides native print management capabilities on Windows through the built-in PrintManagement module. System administrators can inspect connected physical and virtual printers, route text streams and documents directly to output trays, monitor print queues, cancel stalled print jobs, and provision new network printers, all without opening graphical management consoles like Devices and Printers.
Inspecting Printers with Get-Printer
The Get-Printer cmdlet enumerates physical and virtual print devices configured on the local system or on remote print servers.
Get-PrinterName ComputerName Type DriverName PortName Shared Published
---- ------------ ---- ---------- -------- ------ ---------
Brother HL-L2350DW series Local Brother HL-L2350DW ser... WSD-8f12b3c4... False False
Microsoft Print to PDF Local Microsoft Print To PDF PORTPROMPT: False False
OneNote (Desktop) Local Send to Microsoft OneN... nun001: False Falsewhere:
Nameidentifies the printer as registered in Windows.DriverNameshows the print driver backing the device.PortNameindicates the communication port used.SharedandPublishedreflect whether the printer is exposed on the network.-ComputerNamecan be added to query printers installed on a remote machine over the network.
Filtering and Inspecting Device Properties
Filter to a specific printer using -Name, and inspect detailed operational status:
Get-Printer -Name "Microsoft Print to PDF" | Format-List -Property Name, DriverName, PortName, PrinterStatus, JobCountName : Microsoft Print to PDF
DriverName : Microsoft Print To PDF
PortName : PORTPROMPT:
PrinterStatus : Normal
JobCount : 0To identify the system's active default printer, query the CIM class Win32_Printer:
Get-CimInstance -ClassName Win32_Printer | Where-Object { $_.Default -eq $true } | Select-Object Name, PortName, DriverNameName PortName DriverName
---- -------- ----------
Brother HL-L2350DW series WSD-8f12b3c4... Brother HL-L2350DW seriesPrinting Documents and Output Streams
PowerShell supports two primary techniques for printing: sending text streams directly to a printer using Out-Printer, and opening document files via their registered Windows shell handlers with Start-Process -Verb Print.
Streaming Pipeline Text with Out-Printer
The Out-Printer cmdlet redirects standard pipeline output (Stream 1) directly to a specified printer. If no printer is explicitly specified using -Name, output is sent to the system's default printer.
Get-Service |
Where-Object { $_.Status -eq "Running" } |
Format-Table -Property Name, DisplayName, StartType |
Out-Printerwhere:
Get-Servicecollects service objects from the local machine.Where-Objectisolates running services.Format-Tableconverts the objects into visual columnar text before transmission.Out-Printertransmits the formatted text stream to the default Windows printer.
You can also target a specific printer with -Name:
Get-Content "C:\Reports\summary.txt" | Out-Printer -Name "HP LaserJet Pro M404"Printing Complex Documents with Start-Process -Verb Print
Out-Printer converts incoming objects into plain text. It cannot render formatted documents such as PDFs, Word files (.docx), or images. To print compiled binary documents, call the native Windows print handler using Start-Process with the Print or PrintTo verb.
Start-Process -FilePath "C:\Reports\invoice.pdf" -Verb PrintTo target a specific alternative printer without changing system defaults, use -Verb PrintTo with the printer name as an argument:
$DocumentPath = "C:\Reports\QuarterlyAudit.pdf"
$TargetPrinter = "Brother HL-L2350DW series"
Start-Process -FilePath $DocumentPath -Verb PrintTo -ArgumentList "`"$TargetPrinter`"" -PassThru | Out-Nullwhere:
-FilePathspecifies the document to print.-Verb PrintToinstructs Windows to launch the associated application (e.g., Adobe Acrobat or Edge) in background print mode directed at a specific device.-ArgumentListpasses the target printer name enclosed in escaped quotation marks.
Managing Print Queues and Spooler Jobs
When a document is sent to a printer, the Windows Print Spooler service (Spooler) creates a print job in that device's queue. PowerShell allows administrators to inspect, pause, restart, and remove these spooler jobs.
Querying Jobs with Get-PrintJob
The Get-PrintJob cmdlet inspects the documents currently waiting in a printer's queue:
Get-PrintJob -PrinterName "Brother HL-L2350DW series"Id ComputerName PrinterName DocumentName DataType JobStatus
-- ------------ ----------- ------------ -------- ---------
12 Brother HL-L2350DW ser... QuarterlyAudit.pdf RAW Printing
13 Brother HL-L2350DW ser... ServerInventory... RAW Spoolingwhere:
Iduniquely identifies each queued job on that printer.JobStatusshows the current state (Spooling,Printing,Error,Paused).
Removing Print Jobs with Remove-PrintJob
If a print job is stalled or corrupted, delete it using Remove-PrintJob, identified by its printer name and job ID:
Remove-PrintJob -PrinterName "Brother HL-L2350DW series" -ID 12To cancel every pending job on a printer at once, pipe Get-PrintJob directly into Remove-PrintJob:
Get-PrintJob -PrinterName "Brother HL-L2350DW series" | Remove-PrintJobTo clear all pending print jobs across all local queues simultaneously:
Get-Printer | ForEach-Object {
Get-PrintJob -PrinterObject $_ | Remove-PrintJob
}Adding and Removing Printers
Configuring local or shared enterprise network printers is handled using Add-Printer, Add-PrinterPort, and Remove-Printer.
Connecting to a Shared Network Printer
To connect a client computer to a network printer hosted on a Windows print server:
Add-Printer -ConnectionName "\\PrintServer01\Finance-LaserJet"where -ConnectionName specifies the UNC path to the shared network print resource.
Creating a Local TCP/IP Port and Adding a Printer
Provisioning a direct network printer with its own IP address requires configuring a printer port and driver first:
Add-PrinterPort -Name "IP_192.168.10.45" -PrinterHostAddress "192.168.10.45"
Add-Printer -Name "Warehouse-Label-Printer" `
-DriverName "Generic / Text Only" `
-PortName "IP_192.168.10.45"where:
Add-PrinterPortcreates a TCP/IP communication socket at port 9100 pointing to the printer's network address.Add-Printerbinds the port, an installed driver name, and a friendly name together into a functional device.
Removing a Printer
To delete a printer mapping or unbind a device:
Remove-Printer -Name "Warehouse-Label-Printer"Practical Example: Automated Print Spooler Queue Health Audit
The following script scans all printers configured on the host, inspects their queues for stalled or erroring jobs, calculates queue backlogs, and outputs a structured health summary:
$Printers = Get-Printer
$QueueReport = foreach ($Printer in $Printers) {
$Jobs = Get-PrintJob -PrinterObject $Printer -ErrorAction SilentlyContinue
$StalledJobs = $Jobs | Where-Object { $_.JobStatus -match "Error|UserIntervention|Offline" }
[PSCustomObject]@{
PrinterName = $Printer.Name
Driver = $Printer.DriverName
Port = $Printer.PortName
Shared = $Printer.Shared
PendingJobs = ($Jobs.Count)
StalledJobs = ($StalledJobs.Count)
RequiresAction = ($StalledJobs.Count -gt 0)
}
}
$QueueReportwhere:
Get-Printergathers all locally configured print devices.Get-PrintJob -PrinterObject $Printerpasses the printer object directly to inspect its queue.Where-Object { $_.JobStatus -match ... }filters for jobs in unhealthy states using regular expressions.[PSCustomObject]aggregates device metrics into a structured report.
Execute the script from the console:
pwsh ./audit-print-spooler.ps1PrinterName : OneNote for Windows 10
Driver : Microsoft Software Printer Driver
Port : Microsoft.Office.OneNote_16001.14326.22594.0_x64__8wekyb3d8bbwe_microsoft.onenoteim_S-1-5-21-2274977739-1597439238-4225179071-1000
Shared : False
PendingJobs : 0
StalledJobs : 0
RequiresAction : False
PrinterName : Microsoft XPS Document Writer
Driver : Microsoft XPS Document Writer v4
Port : PORTPROMPT:
Shared : False
PendingJobs : 0
StalledJobs : 0
RequiresAction : False
PrinterName : Microsoft Print to PDF
Driver : Microsoft Print To PDF
Port : PORTPROMPT:
Shared : False
PendingJobs : 0
StalledJobs : 0
RequiresAction : False
PrinterName : Fax
Driver : Microsoft Shared Fax Driver
Port : SHRFAX:
Shared : False
PendingJobs : 0
StalledJobs : 0
RequiresAction : False