Sometimes, managing a print server can be a real pain… Ok, who are we kidding? It’s a pain! Period. Printer failures, new installations or someone forgot to tell you they tossed that printer into the garbage compactor. These are all things that can add up to have printer queues hanging around that are just not being utilized any longer.
To help resolve this, I wrote a PowerShell script that audits the printer queues on a server (locally or remote) and will tell us whether or not a Printer Queue has been used and if so, when it was last used.
The script works by first grabbing a list all of the printer queues on a print server. It then goes through all the logs in the print server’s event log and looks specifically for ‘Print’ events. The key events we are looking for are the ones like below as they have the information we need, a queue name and a time. This is what it looks like on a Windows 2003 server:
"Document [number], [title] owned by [user] was printed on [printer] via port [port]. Size in bytes: [bytes]; pages printed: [pages]"
It can take a while to sort through all the events but as it does it tracks whether or not a queue has been used and when the last time it was used.
Once complete we get a nice little CSV file to look at. From there it should be pretty obvious which queues are in use or not.
Hold it! There is a caveat… isn’t there always? The script can only go back as far as the event log does. So if your servers are configured to discard old events or the System log has recently been cleared this script may not be as helpful. Either way, the script is below. Enjoy!