Managing Distribution Groups

Adding Members

Members can be added to a mail-enabled, universal group using powershell commands.

Extract details of the members from an existing group using the Get-DistributionGroupMember command. You can limit the information obtained to a single field e.g. PrimarySmtpAddress. The following command will do just that –

Get-DistributionGroupMember cmc-team |select PrimarySmtpAddress |Export-Csv cmc-addr.csv

The file it produces will be of the form –

#TYPE Selected.Microsoft.Exchange.Data.Directory.Management.ReducedRecipient

“PrimarySmtpAddress”
“a.manager@qub.ac.uk”
“f.bloggs@qub.ac.uk”
“j.soap@qub.ac.uk”

You need to produce a CSV file in the same format to add a list of members to a group. Import the CSV file to the group as follows –

Import-Csv cmc-addr.csv | foreach {add-distributiongroupmember -Identity cmc-team -member $_.PrimarySmtpAddress}

Note: If you have a list of staff IDs instead of addresses you need to use the SamAccountname attribute instead. The CSV file needs to be in the following format –

#TYPE Selected.Microsoft.Exchange.Data.Directory.Management.ReducedRecipient
“SamAccountName”
“1234567”
“7654321”
“1212343”

The import command in this case would be –

Import-Csv cmc-sam.csv | foreach {add-distributiongroupmember -Identity cmc-team -member $_.SamAccountName}

Hiding List Membership

Sometimes you do not want recipients of messages sent via mail-enabled groups to be able to expand the recipient list. Do the following to hide the recipients –

  1. Open Active Directory Users and Computers console.
  2. Click View Menu and select Advanced Features (to enable it)
  3. Find your Distribution List or Security Group (mail enabled) in the OU. DO NOT search for your group because if you open the DL/Group properties from search windows, it will NOT show the Attribute Editor which is the advanced feature).
  4. Double click to open the DL/Group to see the properties. Go to Attribute Editor tab.
  5. Find hideDLMembership attribute, double click to open and select True. Click OK twice to close the dialog boxes.

It takes a while to take effect the changes while Exchange generates Offline Address Book and Outlook installations retrieve it.