Solved

How can I count physical emails sent from all mailboxes?

Posted on 2010-08-23
10
810 Views
Last Modified: 2012-08-13
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
Comment
Question by:cyberleo2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 12

Expert Comment

by:Gary Dewrell
ID: 33501086
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
 
LVL 13

Expert Comment

by:soostibi
ID: 33501522
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
 

Author Comment

by:cyberleo2000
ID: 33503561
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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:cyberleo2000
ID: 33503779
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
 
LVL 12

Expert Comment

by:Gary Dewrell
ID: 33504040
Add ft -autosize to the end.
0
 
LVL 13

Expert Comment

by:soostibi
ID: 33504057
? 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
 
LVL 13

Accepted Solution

by:
soostibi earned 500 total points
ID: 33504066
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
 
LVL 13

Expert Comment

by:soostibi
ID: 33504091
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
 

Author Closing Comment

by:cyberleo2000
ID: 33504780
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
 
LVL 13

Expert Comment

by:soostibi
ID: 33505053
Actually PowerShell 1.0 does not accept "n", PowerShell 2.0 does.
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question