Removing a corrupted print driver in Windows is not as simple as it should be. Read on if you want to know what athletic training you need to get the job done.
Follow me

Jim Jones

Jim Jones has been a SysAdmin for 15 years and is currently working as a Sr. Network Administrator in West Virginia, USA. Honored to be elected a vExpert and Veeam Vanguard, Jim can be found on Twitter @k00laidIT and at his personal site, koolaid.info.
Follow me

As said before in this space I am not a fan of printing. I believe it to be the devil, and if there is any part of IT that could be killed with fire or automated away it would be printing—and getting rid of paper altogether. Unfortunately, for now, we still have to deal with those little bastards so hey, why not blog about it?

Removing a driver package

Removing a driver package

The old workplace is a mix of HP printers and Canon copiers that also serve as network printers. Recently, we've been running into an issue with the Canon drivers getting corrupted by recent Windows 7 updates. Unfortunately, dealing with the issue isn't as simple as right-click delete, so it's once again time for documentation.

The short version of the fix is entering Print Manager, restarting the print spooler, and then just as the print server is starting, backup delete the driver in the instant before the printer is active. The long version is where all that athletic training we never got comes into play, because this is 100% a timing issue.

  1. The first step is opening up the Print Server Properties UI in admin mode. I've found the easiest way to do this is to open an elevated command prompt and type in “printui /s /t2”. This will list any and all print drivers that are installed on your local machine. Now you would think that being simply clicking that big Remove button shown below would have the desired effect, but no. More often than not you’ll be prompted that you can’t remove it because it’s in use, regardless of whether it’s in use by a connected printer.
    Print Server Properties

    Print Server Properties

    Removing a driver package errors

    Removing a driver package errors

  1. So now that we know it won’t work simply, let’s start with (if you haven’t already) removing the printer from Devices and Printers. Considering the skill level of the readers of this website, I don’t think I need to spell this out.
  2. Now we need to start the process of deleting the driver. Click on the driver you want in the Print Server Properties window, then remove. You will then be asked if you want to remove just the driver or the driver and the driver package as well. Do the latter, then hit OK.
  3. So now you are presented with the “do you really want to do this” dialog box as shown below. Before you hit Yes we need to go back to our elevated command prompt. In my experience, you need to keep this window to where you can see both the command prompt and the dialog box, preferably with the mouse hovering over the Yes button as you type in the other.
    Deleting the printer driver package

    Deleting the printer driver package

  1. In the command prompt windows we need to restart the print spooler service through the command “net stop spooler && net start spooler”. As soon as you see the “The Print Spooler service was started successfully” hit the Yes button on your open dialog box. If the Gods are with you and you had cat‑like reflexes you should now be presented with the “Driver package deleted” message as shown at the top of this article.

In the end, this shouldn’t be this hard. It has to do with the DLLs used by the print drivers being bound at a very low level in the operating system and nothing will unbind them easily. What amazed me is that there isn’t even a safe mode version of this that works easily. But as long as the print spooler isn’t running, the Print Server Properties window will be blank. If you’re having a similar experience to what I’ve had you’ll now be able to just re-add the network printer as you normally would and have the driver reinstall itself and work perfectly.

Finally, I’d love to hear if you’ve got a better way to do this.

Are you an IT pro? Apply for membership!

Your question was not answered? Ask in the forum!

5+

Users who have LIKED this post:

  • avatar
Share
5 Comments
  1. Darren White 4 years ago

    What about Printer Adminisistration scripts (prn*.vbs)? They are included by default since Windows XP or Vista. You can perform nearly any printer, driver, port, or queue operations from the command line.

    They should be located under the following folders:
    32 bit Windows - C:\Windows\System32\Printing_Admin_Scripts\en-US\prn*.vbs
    64 bit Windows - C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prn*.vbs

    An example use sequence -

    Find printer and driver names:
    C:\> cscript /nologo "C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnmngr.vbs" -l | findstr /i /c:"name"
    Server name
    Printer name \\print-server\Mailroom-color-pcl
    Share name Mailroom-color-pcl
    Driver name Canon iR-ADV C5045/5051 PCL5c

    Confirm driver details (Name, Version, Environment):
    C:\> cscript /nologo "C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prndrvr.vbs" -l | findstr /i /b /c:"Driver name"
    Driver name Canon iR-ADV C5045/5051 PCL5c,3,Windows x64

    Attempt driver removal:
    C:\> cscript /nologo "C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prndrvr.vbs" -d -m "Canon iR-ADV C5045/5051 PCL5c" -v 3 -e "Windows x64"
    Unable to delete printer driver Canon iR-ADV C5045/5051 PCL5c Error 0x80041001 Generic failure
    Operation DeleteInstance
    Provider Win32 Provider
    Description The specified printer driver is currently in use.
    Win32 error code 3001

    The driver is in use and locked, as expected. To delete the printer connection:
    C:\> cscript /nologo "C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prnmngr.vbs" -d -p "\\print-server\Mailroom-color-pcl"
    Deleted printer \\print-server\Mailroom-color-pcl

    Stop the Print Spooler to unlock all driver files:
    C:\> NET STOP Spooler
    The Print Spooler service is stopping.
    The Print Spooler service was stopped successfully.

    Start the Print Spooler and immediately delete the driver (single command line):
    C:\> NET START Spooler & cscript /nologo "C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prndrvr.vbs" -d -m "Canon iR-ADV C5045/5051 PCL5c" -v 3 -e "Windows x64"
    The Print Spooler service is starting.
    The Print Spooler service was started successfully.
    Deleted printer driver Canon iR-ADV C5045/5051 PCL5c,3,Windows x64
    Assuming the last option didn't work, you could manually delete the driver files:
    C:\> cscript /nologo "C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prndrvr.vbs" -l | findstr /i /r /c:"Driver name" /c:"%SystemDrive%"
    Driver name Canon iR-ADV C5045/5051 PCL5c,3,Windows x64
    Driver path C:\Windows\system32\spool\DRIVERS\x64\3\Cnp50M_DB5CE.DLL
    Data file C:\Windows\system32\spool\DRIVERS\x64\3\iRC504PU.XPD
    Config file C:\Windows\system32\spool\DRIVERS\x64\3\Cnp50MUI_DB5CE.DLL
    Help file C:\Windows\system32\spool\DRIVERS\x64\3\CNP51U_DB5CE.CHM
    C:\Windows\system32\spool\DRIVERS\x64\3\IRC504PU.UPD
    C:\Windows\system32\spool\DRIVERS\x64\3\CnPC_29A.dat
    C:\Windows\system32\spool\DRIVERS\x64\3\Cnp50409_DB5CE.DLL
    < Additional lines Deleted >

    Capture the list of files, then stop the spooler and delete those files manually. (Put the list into a batch file, prefixing each filename with "del /q")  After that, start the spooler and make sure that the driver is removed.

    Sometimes IT comes down to brute force athletics... But I think we all prefer working smarter, not harder. Once you have the necessary information, the athletics are avoided with one stacked command to restart the spooler and immediately delete the driver:

    NET STOP Spooler & NET START Spooler & cscript /nologo "C:\Windows\SysWOW64\Printing_Admin_Scripts\en-US\prndrvr.vbs" -d -m "Canon iR-ADV C5045/5051 PCL5c" -v 3 -e "Windows x64"

    0

  2. Babun 4 years ago

    I seem to recall removing printer driver entries on a per-driver per-key basis from the registry, and then i'd recall you were able to overwrite the files / reinstall the driver

    0

  3. Brook 4 years ago

    You can always download and use a utility published by Kyocera for removing print driver files and registry entries for printers.

    0

  4. Nalinda 1 year ago

    thank you.. it worked perfectly..

    0

  5. Rob Schwab 6 months ago

    Awesome, many thanks indeed

    0

Leave a reply

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

*

© 4sysops 2006 - 2019

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account