Powershell to count the total number of email sent to Exchange distribution group

Senior IT System Engineer
Senior IT System Engineer used Ask the Experts™
on
Hi,

Can Powershell be used to pull some stats to tell over the course of the last month the total of e-mails have been sent to the e-mail groups.

Be great if I can get a break down of internal and external and who they're from.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Vikas ShahCurrently Seeking Opportunities

Commented:

Author

Commented:
Thanks for the reply Vikash, what I'd like to know is the statistics for the custom list of my distribution groups, more like in this thread: http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_26441077.html

If the script can be modified so that it list the result like the following:

Name     : group1@domain.com
Count    : 12
totalMBs : 23
From Internal @domain.com : 10  
From External : 2

Name     : group2@domain.com
Count    : 56
totalMBs : 235
From Internal @domain.com : 48
From External : 8
.
.
.
.

That'd be great if it is possible.
Top Expert 2011

Commented:
Which version of exchange?
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Author

Commented:
2007 SP1 with Powershell 2.0 installed.
Commented:
ok here's the solution that I found
$DG=get-distributiongroup
$incount=0
$excount=0
foreach ($item in $DG)
{
$msg=get-messagetrackinglog -start "2011-07-25 00:01" -end "2011-08-8 23:59"-eventid receive -recipients $item.primarySMTPaddress.tostring()
 
$Domainname=get-AcceptedDomain |% {$_.domainname.domain}
 
 $Domain="*@"+$Domainname
 
 foreach ($m in $msg){
 
 if ($m.sender -inotlike "$Domain"){
 $excount+=1
 }
 if ($m.sender -ilike "$Domain"){
 $incount+=1
 } 
}
 
"Distribution Group: "+$item.name
"Internal: " +$incount
"External: " +$excount
$incount=0
$excount=0
}

Open in new window

Author

Commented:
Here's the solution.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial