Forcibly Remove Print Drivers in Windows



Table of Contents

INTRO

Microsoft Windows Logo Curious Blue Background

We can forcibly remove print drivers in Windows. In IT dealing with printers can be a pain. There are many reasons for this including but not limited to network issues, printer firmware bugs, driver instability, and lacking application support.

Sometimes during troubleshooting, one of the steps is to uninstall and reinstall a printer and the driver associated with it, whether the same driver or a newer one. You may find that Windows may prompt you with an error when trying to delete a certain printer or driver from the Print Management console.

I have spent time researching and testing and have created a PowerShell script that will do the majority of the tasks that cause headaches when troubleshooting printers. This should work for both local and network printers installed in Windows. Please review: Working with Printers in Windows

POWERSHELL SCRIPT

PowerShell
Write-Host "Attempting to create a folder called Third-party-Drivers-Backup in C:\TEMP."
New-Item -Path "C:\TEMP\Third-party-Drivers-Backup" -ItemType Directory -Force

Write-Host "Backing up all third-party drivers to C:\TEMP\Third-party-Drivers-Backup, print drivers will be included."
Export-WindowsDriver -Online -Destination "C:\TEMP\Third-party-Drivers-Backup"

Write-Host "Attempting to delete all third-party printers installed."
Get-Printer | where{$_.Name -notlike 'Microsoft*' -and $_.name -notlike 'Fax*' -and $_.name -notlike 'OneNote*'} | Remove-Printer

Write-Host "Attempting to stop the Print Spooler service."
Stop-Service -Name Spooler

Write-Host "Attempting to create a backup folder called spool_backup for items in the spool folder."
New-Item -Path "$env:SystemRoot\System32\spool_backup" -ItemType Directory -Force

Write-Host "Attempting to move and backup files from the spool folder to the spool_backup folder."
Move-Item -Path "$env:SystemRoot\System32\spool\PRINTERS\*.*" -Destination 'C:\Windows\Sysem32\spool_backup' -Force

Write-Host "Attempting to remove files in the spool folder."
Remove-Item -Path "$env:SystemRoot\System32\spool\PRINTERS\*.*" -Force

Write-Host "Attempting to rename the winprint print processor registry key to winprint.old."
Rename-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\winprint" -NewName "winprint.old"

Write-Host "Attempting to restart the Print Spooler service."
Restart-Service -Name Spooler

Write-Host "Attempting to delete all third-party print drivers."
Get-PrinterDriver | where{$_.Name -notlike 'Microsoft*'} | Remove-PrinterDriver -RemoveFromDriverStore

Write-Host "Attempting to stop the Print Spooler service."
Stop-Service -Name Spooler

Write-Host "Attempting to rename the winprint print processor registry key back to winprint."
Rename-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\winprint.old" -NewName "winprint"

Write-Host "Attempting to restart the print spooler service."
Restart-Service -Name Spooler

Write-Host "Attempting to update Group Policy to detect and install printers and drivers deployed by Print Servers."
GPUpdate /Force

Write-Host "Attempting to restart the print spooler service."
Restart-Service -Name Spooler

Write-Host "The script has finished running, please verify your results in the Print Management console."

Once done, use Print Management on the client to see your results, review the “All Printers” and “All Drivers” list and verify your Microsoft defaults are still there, which they should be , but also verify that all third-party drivers and printers are gone. Depending on several factors, you may also already see printers and drivers pulled down from the Print Server and or Windows Update.

CONCLUSION

I have spent a good amount of time to write this and am happy about it. Dealing with printers over the years, this will really come in handy for me and I hope you as well. Peace out!

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *