I had a challenge last month with a work printers. The local printer company is charging us per page printed. We have a baseline included amount of how many we can print. One month we blow past the amount of page we were allows resulting in overage.
I was tasked with find how has been doing all this printing and why. So I get to work looking at the printer logs on the printer via the web (GUI) interface. But there was not way to export the logs and only showed 10 at a time. But after some poking around I discovered do have print server set up on a server. I logged into the print server and discovered that event id and how to show the logs in the Powershell prompt.
So based on the information I needed and how I wanted the log export, I created a powershell script to trigger every first of the month to export the 30 days of printing.
StartTime = (Get-Date).AddDays(-30); ID = 307} | Select-Object -Property Message
$count = (Get-WinEvent -FilterHashTable @{ LogName = “Microsoft-Windows-PrintService/Operational”
StartTime = (Get-Date).AddDays(-30); ID = 307} | Select-Object -Property Message).count
Write-host “count:” $count
$report = @()
foreach ($event in $events){
$item = $event -split(‘ ‘)
$row = New-Object PSObject -Property @{
name = $item[6]
printer = $item[14]
pages = $item[27]
}
$report += $row
}
##Write-Host $report
$report | export-csv {file location}}\”$((Get-Date).ToString(‘yyyyMMdd’))_print.csv” -NoTypeInformation
Now it will export to a CSV file and you can make the columns into data tables to sort and format to cells to you delight like conditional counts. I see you printing all those pages Matt.