PowerShell Manage Printers and Print Queues

PowerShell Manage Printers and Print Queues

PowerShell Tips Editor 3 min read
PowerShell Manage Printers and Print Queues

Stuck print jobs blocking the entire office queue, users calling the help desk every Monday morning because a printer went offline over the weekend — these are predictable, recurring problems that PowerShell solves in seconds. The built-in Print Management cmdlets let you PowerShell manage printers without opening the GUI: list all printers and their status, clear stuck print queues, add network printers, and even set the default printer, all from the command line. This post covers the essential print management operations with practical examples.

List All Printers

Get-Printer returns all locally installed printers including shared and network printers. It requires the PrintManagement module, which ships with Windows:

Import-Module PrintManagement

Get-Printer | Select-Object Name, Type, DriverName, PortName, Shared, PrinterStatus |
    Format-Table -AutoSize
Name                   Type    DriverName          PortName  Shared PrinterStatus
----                   ----    ----------          --------  ------ -------------
HP LaserJet 4350       Local   HP LaserJet 4350    IP_10.1.1.50 True  Normal
Microsoft Print to PDF Local   Microsoft Print to  PORTPROMPT: False Normal
Finance Floor Xerox    Network Xerox Global Print  \\print01\xerox True  Normal

Get Print Queue and Jobs

Get-PrintJob lists all jobs in a printer’s queue. Combine it with Get-Printer to check queues across all printers:

# Check jobs in a specific printer queue
Get-PrintJob -PrinterName "HP LaserJet 4350" |
    Select-Object Id, DocumentName, UserName, Size, SubmittedTime, JobStatus

# Check all queues for any stuck jobs
Get-Printer | ForEach-Object {
    $jobs = Get-PrintJob -PrinterName $_.Name -ErrorAction SilentlyContinue
    if ($jobs) {
        $jobs | Select-Object @{N='Printer';E={$_.PSComputerName ?? $using:_.Name}},
            Id, DocumentName, JobStatus, UserName
    }
}

Clear Stuck Print Jobs

Remove specific print jobs by ID or remove all jobs from a queue. For truly stuck jobs that do not respond to Remove-PrintJob, stopping and restarting the Spooler service clears everything:

# Remove a specific job by ID
Remove-PrintJob -PrinterName "HP LaserJet 4350" -ID 12

# Remove all jobs from a printer queue
Get-PrintJob -PrinterName "HP LaserJet 4350" | Remove-PrintJob

# Nuclear option: restart the spooler to clear all queues on the local machine
Stop-Service -Name Spooler -Force
Start-Service -Name Spooler
Write-Host "Spooler restarted — all print queues cleared"
Spooler restarted — all print queues cleared

Add a Network Printer

Add a network printer connection using Add-Printer. For shared printers on a print server, use the UNC path. For TCP/IP printers, specify the port separately:

# Connect to a shared printer on a print server
Add-Printer -ConnectionName "\\printserver01\HP-Floor3"

# Add a TCP/IP printer (creates port if needed)
Add-PrinterPort -Name "IP_10.1.1.75" -PrinterHostAddress "10.1.1.75"
Add-Printer -Name "Accounting Printer" -DriverName "HP Universal Printing PCL6" `
    -PortName "IP_10.1.1.75" -Shared $true -ShareName "Acct-HP"

Write-Host "Printer added successfully"

Set Default Printer

Set the default printer for the current user session using the SetDefaultPrinter method on the WScript.Network COM object, or via the registry:

# Set default printer using COM object
$network = New-Object -ComObject WScript.Network
$network.SetDefaultPrinter("HP LaserJet 4350")

# Verify
$defaultPrinter = Get-CimInstance -ClassName Win32_Printer |
    Where-Object Default -eq $true
Write-Host "Default printer: $($defaultPrinter.Name)"

Remove a Printer

Remove a printer with Remove-Printer. This removes the printer connection but does not uninstall the driver:

# Remove a specific printer
Remove-Printer -Name "Old Ricoh Copier"

# Remove all printers matching a pattern
Get-Printer | Where-Object Name -like "*Ricoh*" | ForEach-Object {
    Remove-Printer -Name $_.Name
    Write-Host "Removed: $($_.Name)"
}

# Remove an unused printer port after removing the printer
Remove-PrinterPort -Name "IP_10.1.1.75" -ErrorAction SilentlyContinue

Common Errors and Fixes

  • Spooler service must be running to manage print jobs. All print management cmdlets depend on the Print Spooler (Spooler) service. If you get errors accessing printers or jobs, verify the service is running: Get-Service Spooler | Select-Object Status.
  • Remote printer management requires admin rights. Managing printers on a remote computer through -ComputerName requires the Print Operators or Administrators group membership on that machine. Use Invoke-Command with appropriate credentials for remote print management.

Related Cmdlets / See Also

Wrapping Up

PowerShell’s PrintManagement module puts the full print infrastructure under scripted control. Clear stuck queues with Remove-PrintJob or a Spooler restart, add network printers silently for new users, and schedule a daily check for offline printers to catch problems before users notice them.

Send-Item -To