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?
Will SzymkowskiConnect With a Mentor Senior 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.


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,

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.

All Courses

From novice to tech pro — start learning today.