Exchange 2010 script list of sent to email addresses from logs


We would like to run a script on our Exchange 2010 environment to pull off a list of email addresses that a particular user has emailed (into a CSV file).

Does anyone have a script that can do this?  Ideally between a specified date range (but not essential).

Thanks in advance,
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:
The message tracking logs only go back 30 days by default. Check your message tracking log to start.

Check message tracking log:
get-transportserver -identity "servername" | ft  MessageTrackingLogMaxAge

Once you have this information you know how far back you can go using the get-messagetrackinglog cmdlet.

Say it is 30 days use the following command...

If you are running this command locally from your computer you may need to run the following modules/snap-ins before running the script below.

Add-PSSnap-in Microsoft.Exchange.Management.Powershell.Admin
Import-module activedirectory

$date = get-date
Get-MessageTrackingLog -Server "HT Server Name" -Start $Date.adddays(-30) -End $Date - Sender ""

Open in new window

This command will give you all of the items that were sent by this user in the last 30 days.



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
GilesmpAuthor Commented:
Hi Will,

Thanks for that.  I did a bit more research after posting the question and found the info regarding the 30 day limit.  What also hindered us in this process was the default 1Gb limit.  It was actually restricting us to about 2.5 days worth of logs.  We have since increased that so we get a full 30 days.

As we have mail archiving with Symantec Cloud we ended up performing a full export of the user's archive, then exporting a summary from the PST to achieve our end goal.

That script, however, will be very useful for slightly smaller projects.

Many thanks,

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

From novice to tech pro — start learning today.