• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1322
  • Last Modified:

Exchange 2010 report powershell script - no. of emails sent to distribution group

Hi,

Wondering if anyone has a script that can be run on Exchange 2010 logs to show the following:

No. of emails sent to a specific distribution group
Between two dates
Showing number of original emails only (i.e. omits replies/forwards of same email thread)

Thanks in advance,
Giles
0
Gilesmp
Asked:
Gilesmp
1 Solution
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-MessageTrackingLogs - Recipient "Email address of DL" - StartDate "****" -EndDate "***" > C:\data.csv

- Rancy
0
 
page1985Commented:
A few minor corrections...

Name of the cmdlet is Get-MessageTrackingLog (no s)
-StartDate and -EndDate should be -Start and -End
Format of the date for these parameters is MM/DD/YYYY HH:MM:SS

So here's an example to get all emails sent to "list@domain.com" between 8/29/2012 at 2am and 8/29/2012 at 6pm.

Get-MessageTrackingLog -Recipient "list@domain.com" -Start "08/29/2012 02:00:00" -End "08/29/2012 18:00:00"

Also, I like to see certain columns that aren't displayed by default, so I personally would do:

Get-MessageTrackingLog -Recipient "list@domain.com" -Start "08/29/2012 02:00:00" -End "08/29/2012 18:00:00" |Select Timestamp, EventID, Sender, Recipients, MessageSubject, RecipientStatus |Export-Csv "C:\Message-Tracking-Log.csv"

With this, you get the date and time of the message, whether it's incoming or outgoing (in your case will always be incoming), who sent the message, who it went to (in your case always the same address), the subject of the email, and you'll get the SMTP status code showing 2xx if it was sent successfully or the error message if it bounced for any reason.
0
 
AkulshCommented:
To not show replies/forwards, you may want to insert something like this, before Export-csv :
where {MessageSubject -ne "Re:" -or MessageSubject -ne "Fw:"} |
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
GilesmpAuthor Commented:
Hi Page,

Thanks for this.  It does exactly what I want.  As this brings in the email subject and I have to sort the report anyway I just removed FW's and RE's.

Many thanks,
Giles
0
 
GilesmpAuthor Commented:
Hi Akulsh,

Thanks but that addition throws up an error.  However, as mentioned above, I have addressed the forwards and replies.

Many thanks,
Giles
0
 
page1985Commented:
Akulsh almost had it:

|Where {$_.MessageSubject -notlike "Re:*" -and $_.MessageSubject -notlike "Fw:*"}

Glad I could help.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now