Tracking E-mail on Exchange With Powershell

Standard

I had a problem with the delivery of e-mails. The script presented below creates an Excel document with all the e-mails send from a specific e-mail address with the event.

The script takes four arguments:

  1. AddressList
  2. StartDate
  3. EndDate
  4. Output

AddressList

The address list is a mandatory parameter containing the full path to the text file contacining the e-mail adresses.

The file is formatted as follows:

StartDate

The start date is the date from when the list is generated. The start date is not mandatory. If no parameter is given the standard start date is seven days from the day the script is executed.

EndDate

The end date is the date at which the list ends. The end date is not mandatory. If no parameter is given the standard end date is the day the script is executed.

Output

This parameter is full path to a directory where the files need to be saved. The parameter is not mandatory. If no paremeter is given the script will open a new Excel document for each e-mail address present in the source file.

The script outputs an Excel document containing e-mail information with the columns: Timestamp, Sender, Receiver, Event.

Usage
Without the start date and end date

With the start date and end date

The Code

Leave a Reply