Logging and Reporting on Print Jobs with PaperCut

28 Apr

Some time back I wrote a couple of posts on using the free PaperCut software (this one and this one)

I haven’t used it for quite some time, but somewhere else I needed to log and report on Print jobs and so I’ve gone a little further this time.

So the network is all split into VLANs and so only the print server can access the printers. Users talk to the print server, it talks to the printer, so this stops anyone circumventing the logging. All printers are restricted to certain users groups, and all deployed with Group Policy.

First I have a daily PowerShell script to copy the previous days log file over to my SQL server. A scheduled task runs this at 00:01.

Then from the SQL server a job runs at 00:05. This job opens the log file, modifies the Document Name entries to remove any comma’s (as these were causing me a headache) and then re-writes the new CSV file. It calls the SQL command to import this into the database, waits 10 seconds and then removes the CSV files:

The SQL table for this can be found in my previous post.

I then have another SQL table which holds the print costs for each printer:

I have have a link to AD within SQL so I can query each user and return their department for more advanced reporting.

I have a few views to pull data from the last 7 days:

vw_ReportByUser

vw_ReportByDepartment

vw_ReportByPrinter

And of course with a little grouping, you can then pull a costs report for each of these:

So now onto another job that runs to run all the reports and then take the CSV files, attach them to an email and send them out every Monday morning:

All automated, fantastic. Some room for improvement I’m sure, let me know if you have any feedback!