Powershell Script to find the number of sent messages users have sent

Hi,

Can you please help me with this request. I need a powershell script to find the number of sent messages certain customers have sent since May 1st. A manager in a department has requested this information. So if a users has sent 200 messages it will need to be reflected in the report. I'm guessing either csv or html or both. There are about 30 users.

***Update***

Sorry forgot to mention that it's an Exchange Server 2010 environment and the report will also need to show the users alias, first and last name if possible.
makel2Asked:
Who is Participating?
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.

Will SzymkowskiSenior Solution ArchitectCommented:
try the following...
$StartDate = "05/01/2015"
$Server = "cas.domain.com"
$Users = import-csv "c:\filename.csv"
ForEach ($User in $Users) {
$User.EmailAddress
        
        Get-MessageTrackingLog -Server $Server -Start $StartDate -Sender $User.EmailAddress | measure | 
        Select $User.EmailAddress, Count |
        Export-Csv "c:\EmailCount.csv" -nti -append

}

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
makel2Author Commented:
Is it possible the script can be updated to reflect specific users and specific SMTP domain name.
0
Will SzymkowskiSenior Solution ArchitectCommented:
Sure not a problem.

Will.
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

makel2Author Commented:
Any chance you can update it so :-)
0
Will SzymkowskiSenior Solution ArchitectCommented:
Here you go...
$StartDate = "05/01/2015"
$Recipient = "*@externaldomain.com"
$Server = "cas.domain.com"
$Users = import-csv "c:\filename.csv"
ForEach ($User in $Users) {
$User.EmailAddress
        
        Get-MessageTrackingLog -Server $Server -Start $StartDate -Sender $User.EmailAddress -Recipient $Recipient | measure | 
        Select $User.EmailAddress, Count |
        Export-Csv "c:\EmailCount.csv" -nti -append

}

Open in new window


I have add the variable $Recipient on line 2. Just change that to the smtp domain you want to search.

You also need to make sure that your csv file has Emailaddress as a column heading, and then all of the users in a separate cell below it.

Will.
0
makel2Author Commented:
That did the trick, thanks
0
Will SzymkowskiSenior Solution ArchitectCommented:
Excellent!

Glad that i could help.

Will.
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
Microsoft Server OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.