Solved

How can I count physical emails sent from all mailboxes?

Posted on 2010-08-23
10
804 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

786 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