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 Drivers.zip

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.

Share on Facebook0Share on LinkedIn0Tweet about this on TwitterShare on Google+0Email this to someone
Posted in Printers, Scripting, Windows, Windows Server and tagged , , , , , , , .

One Comment

  1. I wrote a simmilar program to stop the print spooler and delete stuck jobs.

    net stop spooler
    del %systemroot%\system32\spool\printers\*.shd
    del %systemroot%\system32\spool\printers\*.spl
    net start spooler

    What do the following lines do and how may then enhance what I use now?
    taskkill /F /IM explorer.exe
    taskkill /F /IM spoolsv.exe
    taskkill /F /IM printisolationhost.exe

Leave a Reply to Joshua Cancel reply

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