Tuesday, September 26, 2017

List Members of a Dynamic DL

This comes courtesy of a site I follow "Anand, The Architect. I like it because after trying several other methods this one was spot on and straight forward. I used this in a Exchange 2010 Environment.

First get the dynamic DL named DL-NorthAmerica and assigned to variable $dl.
$dl = Get-DynamicDistributionGroup “DL-NorthAmerica”
Next run the query and list the recipients and assigned to a variable $allr
$allr = Get-Recipient -RecipientPreviewFilter $dl.RecipientFilter -OrganizationalUnit $dl.RecipientContainer –ResultSize Unlimited
List all the recipients with any other information you want.
$allr | Select-Object Name,PrimarySmtpAddress,Title,Department,city
If you want you can save the results to a CSV file.
$allr | Select-Object Name,PrimarySmtpAddress,Title,Department,city | Export-Csv -Path “$pwd\ShoreTel-GlobalMembers.csv” –NoTypeInformation

Reference Link:
https://anandthearchitect.com/2016/01/30/exchange-list-all-members-for-dynamic-distribution-group/

No comments:

Post a Comment