4

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 [email protected] -start “10/22/2011 00:00:00” -end “11/21/2011 11:59:00” -EventId "receive" | measure-object

Get-MessageTrackingLog -sender [email protected] -start “10/22/2011 00:00:00” -end “11/21/2011 11:59:00” -EventId "send" | measure-object

1
  • 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. Oct 5, 2012 at 14:30

2 Answers 2

7
+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 [email protected]       {[email protected], [email protected], ...}
   11 [email protected]      {[email protected], [email protected], ...}
   36 some.address@foreigndo... {[email protected], some.address@for...}
[...]
2
  • Hi, Sorry that was just an example code that I tried to use. We need a month's worth of data.
    – Matt
    Oct 8, 2012 at 7:22
  • 1
    @Matt I've added some information - check out if this is likely to help you.
    – the-wabbit
    Oct 8, 2012 at 12:26
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .