Creating a dynamic distribution group


  • Hi

    I am trying to create a dynamic distribution group using the tag office from the AD account, the group creates fine in AD and shows up in Exchange Admin centre ECP, but no one gets assigned into the group, please see my code below and can you help

    New-DynamicDistributionGroup -Name "Group Name" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (Office -eq 'Office 1' -or Office -eq 'Office 2')}

    In ECP should i see a user and it be a member of Group Name

    Monday, May 14, 2018 3:41 PM

All replies

  • What did you set for "-RecipientContainer"? This is the OU where your members will be pulled from; from what I remember, if you don't set it, the "" OU will be used, and your users most likely aren't housed there.

    Also, the EAC won't show the members list since it's a query. In order to see the members, you'll need to run the following two cmdlets in the EMS:

    $members = Get-DynamicDistributionGroup -Identity "group name"

    Get-Recipient -ResultSize 10000 -RecipientPreviewFilter $members.RecipientFilter -OrganizationalUnit $members.recipientcontainer

    **Note** Change "group name" to match your environment.

    My Blog: My Twitter:

    Monday, May 14, 2018 4:37 PM
  • Hi

    Thanks for your response, i have not set anything for -RecipientContainer and my users are not in, they are for example\folder1\folder2\users\folder 3 and folder4

    How would i include this in my code?


    Wednesday, May 16, 2018 10:40 AM
  • If your users are spread amongst multiple OUs, I would just set the RecipientContainer to the root level.

    So your cmdlet would be:

    New-DynamicDistributionGroup -Name "Group Name" -RecipientContainer "" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (Office -eq 'Office 1' -or Office -eq 'Office 2')}

    That will pull from any OU but still use "Office" as the filter

    My Blog: My Twitter:

    Wednesday, May 16, 2018 4:24 PM
  • Hi

    It all worked perfectly

    Thanks ever so much for your help

    Friday, May 25, 2018 3:49 PM
  • Excellent! Glad to help

    Would you mind marking my answer as an answer so future visitors can find it easily?

    My Blog: My Twitter:

    Saturday, May 26, 2018 9:10 PM