Print jobs on Remote Desktop wont delete from print queue

A remote user was logging into their server to do some work from afar.

When they went to print their work some sort of connection problem occurred and when they reconnected they  had two local printers in their “Printers and Faxes” window with different sessions,  one with a print job (from the disconnected session) and one with no print jobs (from the current session).
When attempting to print again the job would not print and they would disconnect and try again only to find that they now have 3 printers (2 from disconnected session).  This went on for a while they tried to delete the print jobs from the queue but the job never deleted,  it just stayed in the status of “Deleting” or “Deleting – Paused”.  Eventually they ended up with 6 of these printers each with one print job (I am sure they could have put more jobs in a print queue if they really wanted to).
This is the point at which I came in to clear up the issue.
I knew we had to clear out the print queue or that printer would never work.
Here are the steps we had to go through  in order to fix it,

  1. Stop the “Print Spooler” Service. You can do this two ways
    1. From the Command Prompt (Start -> Run -> Type ‘cmd’ -> Click ‘OK’)
      This opens a Command Line Interface,  type “net stop spooler”
    2. Open the Services Console (Start -> Control Panel -> Administrative Tools -> Services)
      Select “Print Spooler” from the list of Services by double clicking and then click “Stop”
  2. Delete all print jobs.  You can also do this two ways
    1. In the open Command Prompt window type del c:windowssystem32spoolprinters*
      Type ‘y’ if it asks you if you are sure
    2. In your Windows Explorer window goto C:windowssystem32spoolprinters
      Delete all files
  3. Restart the print spooler. Either:
    1. In the open Command Prompt window type “net start spooler”
    2. Click the “Start” button on the open “Print Spooler” Service Properties window


There you have it.  For those of you that know how you can create a batch file which will quickly do all of this

net stop spooler
sleep for 5
del /Q /F c:windowssystem32spoolprinters*
net start spooler

The “/Q” switch tells the “del” command to delete the files without prompting if it is “ok to delete on global wildcard”
The “/F” switch tells the “del” command to delete the files even if they are marked read only

To get this batch file to work you will need to get the “sleep” program to pause for a few seconds after the service stops so that the system can release the lock it has on the files.  If you do not have the sleep  program you may find that running the batch file the first time errors out saying it can not access the file.  But run it a second time and it works.