- Removing a corrupted Canon print driver - Fri, Apr 8 2016
- VMware vSphere licensing update 2016 – No love for the little guy - Fri, Mar 25 2016
- Veeam releases free Endpoint Backup 1.5 - Fri, Mar 18 2016
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?
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.
- 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.
- 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.
- 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.
- 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.
- 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.
Subscribe to 4sysops newsletter!
Finally, I’d love to hear if you’ve got a better way to do this.
Want to write for 4sysops? We are looking for new authors.
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”
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
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
< 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”
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
You can always download and use a utility published by Kyocera for removing print driver files and registry entries for printers.
thank you.. it worked perfectly..
Awesome, many thanks indeed
Thank you!! I'm not sure it is really using the black ink as the color isn't as dark as I would like, but it is printing!!!! And the driver interface if that is what it is called is different. It appears Canon updated without notice and basically screwed up my ability to print, but your help has fixed it. (when I connected my laptop it immediately showed that it was updating the printer, at which time it stopped working–now to fix that one!) Many thanks!
I just had to do this and what worked for me was to “remove” the corrupted print driver by overwriting it with the same driver. I went in and was able to install a new printer (pick any port as it doesn’t matter) then use the “Have Disk” button to chose your printer driver. This installs the driver again cleanly and seems to work if you do it locally OR by installing the “new” driver on the server.
Another approach would be to backup the entire printing configuration, before and possibly after installing a printer or printer driver…
PS > Push-Location “$($([System.Environment]::SystemDirectory))\spool\tools\”
PS > .\PrintBrm.exe -B -F C:\Admin\Config\Printing\Baseline.printerExport
Prepending these lines to a printer install script will avoid the problem of forgetting to run them.
When required, the baseline printing configuration can be restored…
PS > .\PrintBrm.exe -R -F C:\Admin\Config\Printing\Baseline.printerExport
This is a great idea. I remember using printbrm utility to migrate my print server a long ago and I hope it still works.
Thanks. See this article for useful info that is relevant to this post:
Btw, *.printerExport is just a cab file.