Pruning Exchange Distribution Lists

Post to Twitter Post to Facebook Post to StumbleUpon

Some organizations end up having cluttered distribution lists still populated with mailboxes belonging to employees who have left the company. One strategy I’ve employed is when an employee leaves, to add their mailbox to a Distribution List I call “Sunset”. That list contains all non-active employees whose mailboxes have not been deleted yet.

Once the mailbox is listed there, I can simply run the following script.

Get-DistributionGroup | where {$_.SamAccountName -ne “Sunset”} | get-distributiongroupmember | remove-distributiongroupmember “Sunset”

This checks every distribution group’s membership against the Sunset DL’s membership and removes any members of the Sunset list from the other lists.

Leave a comment

Your email address will not be published. Required fields are marked *

This blog is kept spam free by WP-SpamFree.