Tony Giangreco
asked on
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?
ASKER
Thanks, I'll try it in the morning.
ASKER
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) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : RedirectionNotSupported
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) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : RedirectionNotSupported
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.
Will.
ASKER
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 : CannotConvertArgumentNoMes sage,Micro soft.Excha nge.Manage ment.Trans portLogSea rchTasks.G etMessageT rackingLog
[PS] C:\>
[PS] C:\Windows\system32>CD\
[PS] C:\>$Date = get-date
[PS] C:\>Get-MessageTrackingLog
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 : CannotConvertArgumentNoMes
[PS] C:\>
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.
I got all of the emails for that duration.
Will.
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
I got all of the emails for that duration.
Will.
ASKER
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
[PS] C:\>Get-MessageTrackingLog
Count : 607
Average :
Sum :
Maximum :
Minimum :
Property :
[PS] C:\>Get-MessageTrackingLog
WARNING: There are more results available than are currently displayed. To view them, increase the value of the ResultSize
ASKER
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 :
[PS] C:\>Get-MessageTrackingLog
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 :
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Worked perfect! Thanks for the help.
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.