![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Calculate Printer Page Count Per User I have a script that pulls all print events from the main print server and archive them. Now I would like to take those archives and come up with a total page count for each user. Initially I am only looking to do this for one particular printer. I have a powershell function that returns the username and the page count for that particular print job from the printer I want to report on. The results look something like this: domain\userone 2 domain\usertwo 3 domain\userone 21 domain\userthree 5 domain\usertwo 6 domain\userone 346 I can have the function return that comma separated if that will make things easier. Now in this same script I want to total the number of pages printed for each user. Can someone point me in the right direction on how I should go about summing the page count up for each user? Thanks! Jeffrey |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Calculate Printer Page Count Per User If you have the raw data in a file called report.txt, then the following will do the job: $rep = gc report.txt $totals = @{} #create a hash to hold totals $rep | foreach-object { ($name, $pages) = $_.split(" "); #get the name and pagecount from one line of file ($totals.$name) += [int]$pages #initialize or increment the total for the hash entry keyed by $name } $totals # display the totals "Jeffrey Tadlock" wrote: > I have a script that pulls all print events from the main print server and > archive them. Now I would like to take those archives and come up with a > total page count for each user. Initially I am only looking to do this for > one particular printer. > > I have a powershell function that returns the username and the page count > for that particular print job from the printer I want to report on. The > results look something like this: > > domain\userone 2 > domain\usertwo 3 > domain\userone 21 > domain\userthree 5 > domain\usertwo 6 > domain\userone 346 > > I can have the function return that comma separated if that will make things > easier. > > Now in this same script I want to total the number of pages printed for each > user. Can someone point me in the right direction on how I should go about > summing the page count up for each user? > > Thanks! > Jeffrey > > > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Calculate Printer Page Count Per User Thank you! This worked just as I needed. Your help is appreciated. --Jeffrey "forestial" <forestial@discussions.microsoft.com> wrote in message news:6A87108F-904A-4445-A4BD-C59CAC976B33@microsoft.com... > If you have the raw data in a file called report.txt, then the following > will > do the job: > > $rep = gc report.txt > $totals = @{} #create a hash to hold totals > $rep | foreach-object { > ($name, $pages) = $_.split(" "); #get the name and pagecount from one > line > of file > ($totals.$name) += [int]$pages #initialize or increment the total for > the > hash entry keyed by $name > } > $totals # display the totals > > "Jeffrey Tadlock" wrote: >> I have a powershell function that returns the username and the page count >> for that particular print job from the printer I want to report on. The >> results look something like this: >> >> domain\userone 2 >> domain\usertwo 3 >> domain\userone 21 >> domain\userthree 5 >> domain\usertwo 6 >> domain\userone 346 >> >> Now in this same script I want to total the number of pages printed for >> each >> user. Can someone point me in the right direction on how I should go >> about >> summing the page count up for each user? |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Calculate Printer Page Count Per User "Jeffrey Tadlock" > and come up with a total page > count for each user. > > domain\userone 2 > domain\usertwo 3 > domain\userone 21 > domain\userthree 5 > domain\usertwo 6 > domain\userone 346 > Perhaps Microsoft's Log Parser 2.2 PS> LogParser.exe "SELECT field1 AS User, SUM(field2) AS PageCountTotals FROM pa geCount.txt GROUP BY User" -i:tsv -headerRow ff -iSeparator:"space" -stats ffUser PageCountTotals ---------------- --------------- domain\userone 369 domain\usertwo 9 domain\userthree 5 PS> Oh and using a chart really shows paper usage! ![]() PS> LogParser.exe "SELECT field1 AS User, SUM(field2) AS PageCountTotals INTO Pa geCounts.gif FROM pageCount.txt GROUP BY User" -i:tsv -headerRow ff -iSeparator:"space" -stats ff -chartType:BarStacked3D -chartTitle:"PaperCounts" -view nPS> Log Parser works in most Windows shells and Windows languages. Just another way! |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| vista print spooler and page count errors. | OneTechForGOD | Vista print fax & scan | 3 | 03-26-2008 05:19 PM |
| Printer page counter needed | Peter in New Zealand | Vista General | 4 | 11-14-2007 07:01 AM |
| User accounts not on log in page | Singer712 | Vista General | 6 | 05-16-2007 08:58 AM |
| Cannot access printer via web page | Disp350 | Vista General | 0 | 05-06-2007 04:55 PM |
| My printer prints only the top of the page. | Mattesonjd | Vista print fax & scan | 0 | 02-24-2007 04:27 PM |