Skip to content

printers_remove_all.ps1

Corey Watson edited this page Dec 19, 2025 · 1 revision

printers_remove_all.ps1

Removes ALL installed printers, their associated ports, and unused printer drivers from Windows.

Overview

This script is a destructive operation that removes all installed printers, their associated ports, and unused printer drivers from Windows. Use with caution - this cannot be undone.

Purpose

Removes ALL installed printers, their associated ports, and unused printer drivers from Windows. Use with caution - this is a destructive operation that cannot be undone.

Prerequisites

  • Windows 10/11 or Windows Server
  • Administrator privileges
  • Print Spooler service running

Configuration

Required Inputs

  • $removeDrivers : Whether to also remove unused printer drivers (default: true)
  • $removePorts : Whether to also remove orphaned printer ports (default: true)

Behavior

  1. Enumerates all installed printers
  2. Removes each printer
  3. Removes orphaned TCP/IP printer ports (optional)
  4. Removes unused printer drivers (optional)
  5. Reports results

Security Notes

  • No secrets in logs
  • Destructive operation - removes ALL printers
  • Cannot be undone without reinstalling printers

Exit Codes

  • 0 = Success
  • 1 = Failure

Example Output

[ INPUT VALIDATION ]
--------------------------------------------------------------
Remove Drivers : True
Remove Ports   : True

[ REMOVING PRINTERS ]
--------------------------------------------------------------
Found 3 printer(s)
Removing : HP LaserJet Pro MFP M428fdw
Removing : Microsoft Print to PDF
Removing : Canon LBP6030
Removed 3 printer(s)

[ REMOVING PRINTER PORTS ]
--------------------------------------------------------------
Found 2 orphaned port(s)
Removing : IP_192.168.1.100
Removing : IP_192.168.1.101
Removed 2 port(s)

[ REMOVING UNUSED DRIVERS ]
--------------------------------------------------------------
Removed unused printer drivers

[ FINAL STATUS ]
--------------------------------------------------------------
Result : All printers removed successfully

[ SCRIPT COMPLETED ]
--------------------------------------------------------------

Version History

  • 2024-12-01 v1.0.0 - Initial release - converted from batch script

Links

Clone this wiki locally