Clear a stuck queue properly and prove the order of operations matters
Task
Demonstrate that spool files cannot be deleted while the service holds them open, which is why the standard procedure has its steps in the order it does.
Steps
- Create a queue if you do not have one, using a print-to-file or virtual device, and record it in
lab/queue/device.txt. - Submit a job and pause the queue so the job is held. Record the queue state in
lab/queue/held.txt. - With the spooler service RUNNING, attempt to delete the spool files directly and record the exact error in
lab/queue/denied.txt. Do it from an ELEVATED prompt: on Windows the spool folder (C:\Windows\System32\spool\PRINTERS) cannot even be listed by a standard user, so without elevation the refusal is "Access is denied" -- a permissions error that says nothing about the lock this step exists to show. The lock reads as the file being open in the spooler's process. - Stop the spooler service, delete the spool files, start the service, and record each step's output in
lab/queue/cleared.txt. - Write
lab/queue/order.mdstating why step three fails, why the documented procedure works, and what a user reporting 'nobody can print' would have been experiencing.
Verify
These checks run in a POSIX shell: Terminal on macOS or Linux, and on Windows Git Bash (it comes with Git for Windows) or WSL. A stock Windows PowerShell or Command Prompt has no awk or grep, so there the first line fails.
grep -c . lab/queue/device.txt
grep -c . lab/queue/held.txt
grep -c . lab/queue/denied.txt
grep -c . lab/queue/cleared.txt
grep -Eic 'spooler|service|open|lock' lab/queue/order.md
All four observation files non-empty and an explanation naming the service holding the files. The denied file is the important one: it is the evidence that the order of the documented procedure is load-bearing rather than ceremonial.
Notes
Use a virtual or print-to-file device. Holding a job on a shared office queue blocks everybody else's printing, which is the fault this lab is about rather than something to inflict.
This is an independent study companion for CompTIA A+ Core 1 220-1201 and is not produced by or endorsed by CompTIA.