script to count all email received for 50 mailbox on exchange 2013

hello,

i need a powershell script to get mailbox from csv file like this one:

mailbox1@domain.com
mailbox2@domain.com
mailbox3@domain.com
.....

and get for each one the number of email received last 3 month.

all my server are exchange 2013.

thanks
cawasakiAsked:
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.

cawasakiAuthor Commented:
hello Amit,

how i can apply this for 100 emails address?
0
Will SzymkowskiSenior Solution ArchitectCommented:
Use the following script below...
Make sure that your csv heading is Mailbox, then use the code below.
$Date = get-date
$Mailboxes = import-csv "c:\filename.csv"
ForEach ($User in $Mailboxes) {
$User.Mailbox
Get-MessageTrackingLog -Server <CASserver> -Start $Date.AddDays(-7) -Sender $User.Mailbox | measure
}

Open in new window


This will simply get the Count of all messages that were sent from each user that is in your csv file.

Will.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

cawasakiAuthor Commented:
Hello

What i need is count email received on this mailbox not sent

Thanks
0
Will SzymkowskiSenior Solution ArchitectCommented:
Ahh sorry about that, been a long day. I have modified my original script to accommodate your requirements.

$Date = get-date
$Mailboxes = import-csv "c:\filename.csv"
ForEach ($User in $Mailboxes) {
$User.Mailbox
Get-MessageTrackingLog -Server <CASserver> -Start $Date.AddDays(-90) -Recipient $User.Mailbox | measure
}          

Open in new window


Just remember that if your message tracking logs are not set to 3 months back you will only be able to go back as far as what the transport settings are set to. By default it is 30 days.

Will.
0
cawasakiAuthor Commented:
hello,

i need to test this to be sure that the number of email i get from this script is the good number of only mail received and not sent & received.

it possible to get csv file result with mailbow and number like this:

test@domain.com,50
......

thanks
0
Will SzymkowskiSenior Solution ArchitectCommented:
When you use the "measure" command in powershell, it does not have any other attributes to like Displayname or Email address. If you want to export to a CSV use the following command, i have modified the original one.

$Date = get-date
$Mailboxes = import-csv "c:\filename.csv"
ForEach ($User in $Mailboxes) {
$User.Mailbox
Get-MessageTrackingLog -Server <CASserver> -Start $Date.AddDays(-90) -Recipient $User.Mailbox |
Export-Csv "c:\Results.csv" -nti
}          

Open in new window


Will.
0

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
cawasakiAuthor Commented:
i have test the script with -Start $Date.AddDays(-1) to get all email received to day but the number is not good, i have received more 20 email and the script show 11
0
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
Powershell

From novice to tech pro — start learning today.