printers_remove_all.ps1 - limehawk/rmm-scripts GitHub Wiki
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
- Enumerates all installed printers
- Removes each printer
- Removes orphaned TCP/IP printer ports (optional)
- Removes unused printer drivers (optional)
- 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
- View Script Source
- Scripts - Back to script index