Find users using printer server

Right now we are disposing  two old printer servers that we thought no one were using. After we began to log all prints we noticed that it still was hundreds of users using the old printer servers. We could link some of the prints to an old GPO with an VB logon-script but most of the users have probably mapped the printers manually, therefore the client-guys needed a list of users who had users the printer server the last 90 days. First of all you need to start logging all prints, to do so on an Windows 2008 R2 start Print Management and right-click on the server and select properties and check Log spooler information events.

printer_logging

 

Now you just have to wait 90 days and then run this script to get an report of which user that have users printer server.

 

#-------------------------------------------------------------
#NAME: List_priter_users.ps1
#AUTHOR: Viktor Lindström
#
#COMMENTS: List all users that have used printer server last 90 days.
#-------------------------------------------------------------

$date = get-date
$priterservers = "srv-print04", "srv-print05"

foreach ($server in $priterservers)
{$con = get-eventlog -ComputerName $server -log  system  -After $date.AddDays(-90) | where {$_.eventID -eq 10} | select UserName
$uni = $con | Sort-Object username | Get-Unique -AsString
$uni | Export-Csv c:\temp\$server.txt
    }