Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 816
  • Last Modified:

How can I count physical emails sent from all mailboxes?

I need to know how many "physical" emails my users sent during a specific date. I used the program below to export the RECEIVE events on my hub, but I can't figure out how to count them per mailbox.

foreach ($x in get-mailbox -server MYMAILBOXSERVER -resultsize unlimited | %{$_.primarysmtpaddress }){
Get-MessageTrackingLog -Sender $x -Server MYHUBTRANSPORT -EventID RECEIVE -Start "7/1/2010 12:00am" -End "7/31/2010 11:59pm" |ft Sender,TimeStamp,TotalBytes,RecipientCount -autosize
}


thank you
0
cyberleo2000
Asked:
cyberleo2000
  • 5
  • 3
  • 2
1 Solution
 
Gary DewrellSenior Network AdministratorCommented:
Take a look at this. Might be more than you wanted but it does provide the result you are looking for.

http://msexchangeteam.com/archive/2008/02/07/448082.aspx
0
 
soostibiCommented:
What about this? (It is just counting all mail went through the HUB, I did not filter by originating mailbox server.)
Get-MessageTrackingLog -Start 2010.08.19 -end 2010.08.23 -EventId receive -ResultSize unlimited | 
	?{$_.source -eq "storedriver"} | Group-Object sender -NoElement

Open in new window

0
 
cyberleo2000Author Commented:
Thanks soostibi, I totally forgot about the group-Object cmdlet. two questions through, why would you need ?{$_.source -eq "storedriver"}, isn't the fact that your searching for eventid recevie enough? Also, what exactly does "?" at the begining of that line do? is it just a standin for "where"

thanks
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
cyberleo2000Author Commented:
I answered my own question. Without the stordriver search the command returns all messages received by the hub, event external ones. One last question, the output cuts off, as shown below, how can I format the output?

Count Name                    
----- ----                    
  791 MOMAlerts@lendlease.com  
  713 MicrosoftExchange329e7...
  502 imapemeaprod@lendlease...
  433 globalportaladmin@lend...
  226 apoprd@lendlease.com    
  202 root@lendlease.com      
0
 
Gary DewrellSenior Network AdministratorCommented:
Add ft -autosize to the end.
0
 
soostibiCommented:
? is the alias for Where-object cmdlet.
You can format the output by format-table. With a hashtable structure you can set the column name (n="..."), the data expression (e={...}), the alignment (a="left"), and the column width (w=70).
0
 
soostibiCommented:
The code disappeared.
Get-MessageTrackingLog -Start 2010.08.19 -end 2010.08.23 -EventId receive -ResultSize unlimited | 
	?{$_.source -eq "storedriver"} | Group-Object sender -NoElement | 
		Format-Table @{n="message count"; e={$_.count};a="left"; w=20}, @{n="from address"; e={$_.name}; w=70}

Open in new window

0
 
soostibiCommented:
The -autosize has a disadvantage: is you use it, format-table will wait for all the results, calculates the optimal column widths and then outputs the results. With the "manual" hash table formatting as an output borns, it will be emitted to the screen at once.
0
 
cyberleo2000Author Commented:
Thank you for all your help. Note: exchange management shell did not accept n as a key in format-table, although it did accept l for label. thanks again.
0
 
soostibiCommented:
Actually PowerShell 1.0 does not accept "n", PowerShell 2.0 does.
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now