Batch script to delete printer drivers

Friday the 13th…

HP Universal Print drivers… HP1606dn running off server 2008R2… If you’re already starting to get chills down your spine, don’t worry, you’re not alone! Have you had corrupt drivers downloaded from your print server onto your client workstations and BAM your print spooler service chugs and chugs? Here is a quick script that has saved our service desk from painstakingly removing drivers manually:

@echo off
::Delete All Printer Drivers
::Written by samontech

net stop spooler
taskkill /F /IM explorer.exe
taskkill /F /IM spoolsv.exe
taskkill /F /IM printisolationhost.exe
cd /d %windir%\system32\spool\drivers
for /F “delims=” %%i in (‘dir /b’) do (rmdir “%%i” /s/q || del “%%i” /s/q)
start explorer.exe
net start spooler

Delete All Printer

Note: Any Windows Explorer windows open will automatically close.

If you have a print server and your printers are deployed via group policy, then restart your workstations. If this is a standalone machine, restart and reinstall working print drivers.

It’s still a work in progress but for the most part it should do the trick. I’ll be adding more scripts to help you with any future printer problems.