# set Identity to distributiongroup alias
$distributiongroup = Get-DistributionGroup -Identity "#Distribution Group Name"
$groupmembers = Get-DistributionGroupMember -Identity $distributiongroup | Where-Object { $_.RecipientType -eq "UserMailbox" }
foreach ( $member in $groupmembers )
{
$intRec = 0
#Gets the SMTP Address of Mailbox
$smtp = Get-Mailbox -Identity $member.alias | Select -Property PrimarySmtpAddress
#Change Start and End Date where needed, Change source to STOREDRIV for Internal or remove where for all messages ( SMTP = External )
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start “02/01/2015” -End “02/28/2015” -Recipients $smtp.PrimarySmtpAddress -EventID RECEIVE | where {$_.source -eq 'SMTP'} |
ForEach { $intRec++ }
Write-Host "E-mails received from External Source by"$smtp.PrimarySmtpAddress "-" $intRec
}