Solved

How can I count physical emails sent from all mailboxes?

Posted on 2010-08-23
10
806 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
  • 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

In-place Upgrading Dirsync to Azure AD Connect
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

685 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