Need sent Mail Stats from Exchange 2007

On a Windows 2008 R2 Server running Exchange 2007, how do i generate a quick report of incoming and outgoing mail per day, week and month for all users in the domain?
LVL 25
Tony GiangrecoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
Use Message Tracking Log to accomplish this...
$Date = get-date
Get-MessageTrackingLog -Server <hub transport> -Start "$Date.AddDays(-1)" -End "$Date" | measure

Open in new window


This will provide all of the messages internal and external for 1 day. Just modify the -1 and run the script.

Will.
0
Tony GiangrecoAuthor Commented:
Thanks, I'll try it in the morning.
0
Tony GiangrecoAuthor Commented:
I opened powershell on the exchange server and ran that query. I received a syntax error

The '<' operator is reserved for future use.
At line:1 char:33
+ Get-MessageTrackingLog -Server < <<<< hub transport> -Start "$Date.AddDays(-1)" -End "$Date" | measure
    + CategoryInfo          : ParserError: (<:OperatorToken) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RedirectionNotSupported
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Will SzymkowskiSenior Solution ArchitectCommented:
The < hub transport server> is just an example of what needs to go in there. You need to remove the brackets and type in your own hub transport server name. Then rerun the command again.

Will.
0
Tony GiangrecoAuthor Commented:
Ok, made that change. Another error


[PS] C:\Windows\system32>CD\
[PS] C:\>$Date = get-date
[PS] C:\>Get-MessageTrackingLog -Server HPM5 -Start "$Date.AddDays(-1)" -End "$Date" | measure
Get-MessageTrackingLog : Cannot bind parameter 'Start'. Cannot convert value "05/31/2015 13:03:55.AddDays(-1)" to type "System.DateTime". Error: "The string was not recognized as a valid DateTime. There is a unknown word starting at index
20."
At line:1 char:43
+ Get-MessageTrackingLog -Server XXM5 -Start <<<<  "$Date.AddDays(-1)" -End "$Date" | measure
    + CategoryInfo          : InvalidArgument: (:) [Get-MessageTrackingLog], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchange.Management.TransportLogSearchTasks.GetMessageTrackingLog

[PS] C:\>
0
Will SzymkowskiSenior Solution ArchitectCommented:
I have just tested this in my lab and it works without any issues.

Try removing the quotes around $date.addDays(-1).

I ran this exact command in my lab and it worked.
Get-MessageTrackingLog -Server cashub -Start $date.addDays(1-) -End $date | measure

Open in new window


I got all of the emails for that duration.

Will.
0
Tony GiangrecoAuthor Commented:
I ran it twice with -1 and -2 on the end date. the 2nd time, I received a warning:

[PS] C:\>Get-MessageTrackingLog -Server HPM5 -Start $Date.AddDays(-1) -End $Date | measure
Count    : 607
Average  :
Sum      :
Maximum  :
Minimum  :
Property :

[PS] C:\>Get-MessageTrackingLog -Server HPM5 -Start $Date.AddDays(-2) -End $Date | measure
WARNING: There are more results available than are currently displayed. To view them, increase the value of the ResultSize
0
Tony GiangrecoAuthor Commented:
Here is the output from tee 2nd run. I missed copying it

[PS] C:\>Get-MessageTrackingLog -Server HPM5 -Start $Date.AddDays(-2) -End $Date | measure
WARNING: There are more results available than are currently displayed. To view them, increase the value of the ResultSize
parameter.

Count    : 1000
Average  :
Sum      :
Maximum  :
Minimum  :
Property :
0
Will SzymkowskiSenior Solution ArchitectCommented:
Ahhh ok well we just need to use the -ResultSize switch to get all of the results.
Get-MessageTrackingLog -Server HPM5 -ResultSize "unlimited" -Start $Date.AddDays(-2) -End $Date | measure

Open in new window


That should do it.

Will.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tony GiangrecoAuthor Commented:
Worked perfect!  Thanks for the help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.