Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We are using Exchange 2010. I would like to retrieve a list of total sent emails and received emails from all users in the work place for 30 days. The list should have all the users' names, then total of sent and received emails.

I have tried the example code below and tried to change this to no avail.

Get-MessageTrackingLog -Recipients user01@yourdomain.com -start “10/22/2011 00:00:00” -end “11/21/2011 11:59:00” -EventId "receive" | measure-object

Get-MessageTrackingLog -sender user01@yourdomain.com -start “10/22/2011 00:00:00” -end “11/21/2011 11:59:00” -EventId "send" | measure-object

share|improve this question
    
Take a look and see if there are WMI counters for this. It might get reset when the services restart though. I doubt there is any kind of lifetime counter. –  SpacemanSpiff Oct 5 '12 at 14:30
add comment

2 Answers 2

up vote 3 down vote accepted
+50

"By default, the maximum age for any message tracking log file is 30 days" - unless you've changed the message tracking log defaults, you are very unlikely to get a year old data from there (unless you have had virtually no messages so the 10 MB per log file limit has not been hit more than 30 days in the past).

If you need this kind of data to persist, change the maximum age / directory size limit for the logs as described in the docs.

Another point is that the tracking log does not contain user information - it just contains senders and recipients - which might or might not map to actual users of your infrastructure.

Other than that, you could just pipe the result of Get-MessageTrackingLog to group-object for grouping and counting. For grouping by senders, this would be rather trivial:

Get-MessageTrackingLog -start “10/22/2011 00:00:00” -end “11/21/2011 11:59:00” | group-object -Property Sender

Grouping by recipients is trickier as the "Recipients" field returned by Get-MessageTrackingLog is multivalued - i.e. could contain more than one recipient. Prepending a Select-Object -ExpandProperty helps here:

Get-MessageTrackingLog -start “10/22/2011 00:00:00” -end “11/21/2011 11:59:00” | select-object -ExpandProperty Recipients | group-object

The result set is going to look somewhat like this:

Count Name                      Group
----- ----                      -----
   44 mail@yourdomain.com       {mail@yourdomain.com, mail@yourdomain.com, ...}
   11 user1@yourdomain.com      {user1@yourdomain.com, user1@yourdomain.com, ...}
   36 some.address@foreigndo... {some.address@foreigndomain.com, some.address@for...}
[...]
share|improve this answer
    
Hi, Sorry that was just an example code that I tried to use. We need a month's worth of data. –  Matt Oct 8 '12 at 7:22
    
@Matt I've added some information - check out if this is likely to help you. –  the-wabbit Oct 8 '12 at 12:26
add comment

Not sure what you are looking for (still), as I am unsure where you are with the question and how much the comments have helped you so far but, the following script helped me all the way:

http://gallery.technet.microsoft.com/office/f2af711e-defd-476d-896e-8053aa964bc5

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.