Export email statistics for a group of mailboxes in Exchange 2013

Hello,

We are looking for a way to export (to CSV or other readable format) the email statistics for a particular group of users in Exchange 2013. We only need to know the last 7 days stastics and only the following information:

- number of emails sent
- number of emails received

Thanks in advance
LVL 6
vmdudeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Muhammad BurhanManager I.T.Commented:
vmdudeAuthor Commented:
Thanks for this, it is helpful however I am looking for a way to do this on a selection of mailboxes rather than just the one user.
Muhammad BurhanManager I.T.Commented:
give a try with replacing "user@domain" to mailbox
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

vmdudeAuthor Commented:
Thanks, however I was looking for a script to acheive this.

I have found the following script that works for a single mailbox but would like exactly this but adapted for more that one mailbox

https://www.pickysysadmin.ca/2014/10/02/powershell-script-to-report-on-total-sendreceived-e-mails-in-exchange/
Will SzymkowskiSenior Solution ArchitectCommented:
I have created a script a couple weeks ago that will get all Distribution Groups in the domain and export the complete Send/Receive Count total. See the script below...

$Groups = Get-DistributionGroup -Filter * -ResultSize "unlimited"
$StartDate = (Get-Date).AddDays(-7).ToString()
$EndDate = "(Get-Date).ToString()"
$TransportSRV = (Read-Host "type your Transport Server to query logs i.e. server.domain.com")

    ForEach ($Group in $Groups)
        {
    
            $Count = Get-MessageTrackingLog -Server $TransportSRV -Start $StartDate -End $EndDate -Recipients $Group.PrimarySmtpAddress | measure

            $OutPut = @{"DLName"=$Group.PrimarySmtpAddress;
                        "Count"=$Count.Count;

                    }

           $Obj = New-Object -TypeName PSObject -Property $OutPut

           Write-Output $Obj | Export-Csv "c:\results.csv" -NTI -Append


}

Open in new window


All you need to do is change the first line with the groups that you want to check. The script as is will query all Distribution Groups and export each Group Smtp Address and Count for the last 7 days.

Will.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vmdudeAuthor Commented:
Hi Will,

Thanks for this really helpful. The only thing is that the the users I want the script to query against are not in any groups. For example, I want to find out how many emails have been sent and received for the following 5 users

joe.bloggs
jane.briggs
fred.perry
susan.blogger
bill.jones

These users will not change often but we may need to add or remove users in the future.

Is it best to put these users in a group (and if so which type) and report against that?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.