Unable to use PrimarySmtpAddress as a filterable property in a Dynamic Distribution List in Exchange 2013 server.
Question:
I want to create a Dynamic Distribution List based on “PrimarySmtpAddress”. Though this MS Technet article https://docs.microsoft.com/en-us/powershell/exchange/exchange-server/recipient-filters/recipientfilter-properties?view=exchange-ps does says PrimarySmtpAddress is a filterable property, but in reality the option is not working. The “PrimarySmtpAddress” property not working for both create and modify the Dynamic DL.
Example:
New-DynamicDistributionGroup "TestDynamicDL" -OrganizationalUnit "abc.com" -RecipientContainer "abc.com/users" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (PrimarySmtpAddress-like "*abc.com")}
Set-DynamicDistributionGroup "TestDynamicDL" -RecipientContainer "abc.com/users" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (PrimarySmtpAddress-like "*domain.com")}
Error:
While running the above commands it shows the below error: “Property PrimarySmtpAddress does not support Microsoft.Exchange.Data.TextFilter”
[PS] C:\Windows\system32>New-DynamicDistributionGroup "TestDynamicDL" -OrganizationalUnit "abc.com" –RecipientContainer "abc.com/users" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (PrimarySmtpAddress-like "*abc.com")}
Creating a new session for implicit remoting of "New-DynamicDistributionGroup" command...
Property PrimarySmtpAddress does not support Microsoft.Exchange.Data.TextFilter. Only
Microsoft.Exchange.Data.ComparisonFilter is supported.
+ CategoryInfo : NotSpecified: (:) [], ADFilterException
+ FullyQualifiedErrorId : [Server=abcdmbx01,RequestId=8431d2b9-69cd-4596-a9a6-bb8a508fee2a,TimeStamp=12.01.201
9 17:53:54] [FailureCategory=Cmdlet-ADFilterException] 8858BF05
+ PSComputerName : abcdmbx01.abc.com
I need to filter the users based on only Primary Email Address. Since "EmailAddresses" property does not serve my requirement, i am looking for help/suggestion to achieve my goal.
Any help would be highly appreciated.