creating a dynamic distribution group with a RecipientFilter of 'Description'

Copper Contributor

I'm trying to create a dynamic distribution group of full-time employees. Their status is in the user's account description. I've tried the following to no avail:

 

New-DynamicDistributionGroup -Name "DDL-Test" -RecipientFilter "(RecipientType -eq 'UserMailbox') -and (Description -eq 'Employee')".  The Description is the field in on-prem AD under the 'General' tab.

 

I followed this link that says 'Description' is filterable recipient property:

 

https://learn.microsoft.com/en-us/powershell/exchange/recipientfilter-properties?view=exchange-ps

 

Any suggestions?

5 Replies

@gnussbaum hello, maybe this helps:

- i have only exchange on-prem

 

New-DynamicDistributionGroup -Name "DDL-Test" -Alias DDL-Test -OrganizationalUnit "yourAdDomain/yourOU/yourOUforSavingDistributingList" -RecipientFilter {((RecipientTypeDetails -eq 'UserMailbox') -and (Description -eq 'Employee'))} -RecipientContainer "yourAdDomain/yourOU/OUwithUsers"

 

- you dont need Parameter "-RecipientContainer", if your scope is the entire AD

- i didnt do this with the description field, but can test this in the next few days

- if you have exchange online would say is the same, but not sure

 

best wishes

René

thanks René. I don't think you can do this with Exchange Online because the OU points to the one in the online portal, not on-prem.
Maybe you could use of the custom attributes instead and script the copying of the description field into the custom attribute?
Thanks for replying Tony. I was thinking of that, but to be honest, I'm not sure how to do that.
For existing on-premises accounts, you could probably use Get-ADUser to read the description and Set-Mailbox to write the description into a custom attribute, I don't have an on-premises environment to test with to confirm.