In an exchange messaging organizations there is always a need for having a way to report on the Distribution Group Infrastructure's usage (at least based on my experience).
Unfortunately, Microsoft does not provide an easy way to query when a distribution list was last used as a value of one of its attributes.
in here I have written a PowerShell script that can be run as scheduled task on a daily basis from any server and does just that (The following)
- Established PsSession to one of your Exchange Server's Powershell virtual directory.
- Make a message tracking log of every Exchange Server in your organization for hits on distribution lists in the past 30 days (Tracking Log keep data for 30 days by default).
- It will take that report and after cleaning duplicates, it takes the latest hit on a distribution list within that 30 days and will stamp it in its CustomAttribute1.
The Stamp happens based on the following two conditions:
- If the CustomAttribute1 value is empty
- If the CustomAttribute1 value is older than the recent hit pulled from tracking logs
This way you will have a comprehensive way of reporting and determining when a distribution list was last used. This script needs to run every day based on the last 30 days logs which means:
- Any distribution list that has no value of CustomAttribute1 has not been used in the past 30 days
- As time goes the date stamp of CustomAttribute1 keeps showing last used vs 30 days plus 1. For example, if you check a customattribute1 value of a distribution list the next day after you scheduled it to run it shows the last usage in the past 31 days and same goes to no value, which shows the Distribution list has not been used in the past 31 days.
The script will also send an email report of DLs that are stamp and the error that may have happened.
I hope I have explained it right :)
You can always comment here or drop me a message in my Experts Exchange Profile for more question and help.
You can also Download the script from Technet Gallery
Hope this article has helped you out.