Powershell cmdlet to track emails send to one specific email id/mailbox/DL

This is not a new cmdlet but I customized it a bit so that we get some “presentable” output

Scenario:

We need to track all emails send to a mailbox/mail enabled DL with the name – team@msexchangeguru.com

Run From HubStranport Server
------------------------------------------------------------------------------------
Condition 1 – Get all failed/undeliverable emails:
------------------------------------------------------------------------------------
Get-Messagetrackinglog -Recipients: team@msexchangeguru.com -EventID “FAIL” -Start “5/4/2011 9:00:00 AM” -End “5/10/2011 5:00:00 PM” |ft Timestamp, Source, Sender, Recipients, MessageSubject >>C:\output.txt


------------------------------------------------------------------------------------

Condition 2 – Get all success emails
------------------------------------------------------------------------------------
Get-Messagetrackinglog -Recipients: team@msexchangeguru.com -EventID “RECEIVE” -Start “5/4/2011 9:00:00 AM” -End “5/10/2011 5:00:00 PM” |ft Timestamp, Source, Sender, Recipients, MessageSubject >>C:\output.txt


------------------------------------------------------------------------------------
This will give you the output in the form:
Timestamp 	Source 	Sender 	Recipients 	MessageSubject

Source “SMTP” means it’s an external email and “STOREDRIVER” means processed internally

Again remember to edit the properties of the powershell window to make it 400×300.


------------------------------------------------------------------------------------
if you have multiple servers try below..
------------------------------------------------------------------------------------
Get-TransportServer |Get-Messagetrackinglog -Recipients: User.name@mydomainname.com -EventID “RECEIVE” -Start ” 2/1/2014 9:00:00 AM” -End ” 2/05/2014 5:00:00 PM” |ft Timestamp, Source, Sender, Recipients, MessageSubject >>C:output.txt


I got a few errors with this, so Ive changed it somewhat:
Get-Messagetrackinglog -Recipients: user@mydomain.com -EventID “RECEIVE” -Start (get-date).AddDays(-1) -End (get-date)| ft Timestamp, Source, Sender, Recipients, MessageSubject >>C:\Script\output.txt