locked
Dynamic Distrubution Lists - By Manager RRS feed

  • Question

  • I am struggling to create a working dynamic distribution group. My intent is to create DDG's based on a user's manager and their job title. This issue was answered in an already asked question but that resolution does not work for me.

    I am trying to create distribution groups for use by their manager by having the manager and job title item as the filter, using the following script:

    New-DynamicDistributionGroup -DisplayName 'alias' -Name 'alias' -Alias 'namehere' -PrimarySmtpAddress alias@slalom.com  -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (manager -eq "ManagerName")} 

    When this is run the DDL creates appropriately but includes no members that have the designated manager. I have tried to change the -eq operator to -like with no success as well. If i create a DDL using the same script but use the users department as the filter, the list will create and users will populate within it appropriately. This is why i cant figure out what about filtering by manager is causing the issue.

    I have also tried to use the distinguished name with no luck  ex. CN=ManagerName ,OU=dept, ,DC=name,DC=name

    No matter what permutations of the above script I try, nothing seems to work. The group creates, but does not work at all.

    Any help you can provide would be very much appreciated!


    • Edited by IanR20 Friday, May 19, 2017 6:23 PM
    Friday, May 19, 2017 6:22 PM

All replies

  • To use the Manager attribute in a filter, you need to compare it against the DN value. For example:

    Get-Recipient -RecipientPreviewFilter {(Manager -eq 'CN=HuKu,OU=michev.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR03A001,DC=prod,DC=outlook,DC=com') -and (RecipientType -eq "UserMailbox")}

    And the same syntax will work for DDGs:

    New-DynamicDistributionGroup -Name managerDDG -RecipientFilter {(Manager -eq 'CN=HuKu,OU=michev.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR03A001,DC=prod,DC=outlook,DC=com') -and (RecipientType -eq "UserMailbox")}

    To verify, use this:

    Get-Recipient -RecipientPreviewFilter (Get-DynamicDistributionGroup managerDDG).RecipientFilter

    Friday, May 19, 2017 7:49 PM
  • Same result. I have tried the full DN with both -like and -eq The DDG will create properly but when i query the members, the list is blank.

    I have also tested by sending an email to the newly created DDG just to be sure i was not searching for the member list incorrectly and no email is received by the group. 

    Tuesday, May 23, 2017 7:31 PM
  • Where are the objects stored though, and where are you creating the DDG? If it's a different OU, use the RecipientContainer parameter to specify the correct scope (or the domain instead of specific OU).
    Tuesday, May 23, 2017 8:14 PM
  • Creating the DDG directly in o365. 

    Hence my confusion why creating by department or other attribute filter works as intended, but by manager is not.

    Tuesday, May 23, 2017 8:42 PM
  • The example I gave you above is for O365 (you can see the onmicrosoft.com domain). Do you get any results via the first cmdlet?
    Wednesday, May 24, 2017 7:18 AM
  • My apologies.

    No, I get a blank return with no users listed if i use the full DN.

    Tested with another filter just to be sure (department), and i get a return of all users in the group i specified.
    • Edited by IanR20 Thursday, May 25, 2017 9:13 PM
    Thursday, May 25, 2017 9:11 PM
  • Well, do you have the Manager attribute properly populated for these users? Other than that, the only thing I can think of is issue with some special characters in the user DN, for example '
    Friday, May 26, 2017 8:16 AM