Thats not a valid filter:
https://learn.microsoft.com/en-us/powershell/exchange/recipientfilter-properties?view=exchange-ps
You'll have to use something else other than "EmployeeType"
Perhaps a custom attribute or group etc...
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi guys, on our Exchange Management Server, I have imported-module ActiveDirectory.. I am creating new DDL's.
I have successfully been able to create a new DDL with City as a filer, for example:
New-DynamicDistributionGroup -DisplayName allstaff.London -Name allstaff.London -Alias allstaff.London -RecipientContainer "localdomain.com/OU/EMEA" -RecipientFilter "(city -eq 'London')"
^ This works fine.
But I want to also create a new DDL this time using EmployeeType = Perm as a RecipientFilter.
This is what i'm doing:
New-DynamicDistributionGroup -DisplayName allstaff.Perm -Name allstaff.Perm -Alias allstaff.Perm -RecipientContainer "localdomain.com/OU/EMEA" -RecipientFilter "(EmployeeType -eq 'Perm')"
However, when I run this, I get the following error:
Cannot bind parameter 'RecipientFilter' to the target. Exception setting "RecipientFilter": "Invalid filter syntax. For a description of the filter parameter syntax see the command help.
"('employeetype' -eq 'Perm')" at position 2."
I am running this in Exchange Mgmt Shell, and I have imported AD Module.
Thats not a valid filter:
https://learn.microsoft.com/en-us/powershell/exchange/recipientfilter-properties?view=exchange-ps
You'll have to use something else other than "EmployeeType"
Perhaps a custom attribute or group etc...
Hello RandeepSahota
The parameter supports an OPATH filter with limited filterable properties and comparison operators. According to the documentation, employeeType is not filterable with the OPATH filter.
As an alternative, you could have an automated or scripted process that updates an attribute that can be conditionally queried by the dynamic group. Here is an example of using the employeeType to update extensionAttribute1.
Get-AdUser -Filter "employeeType -eq 'Vendor'" |
Set-AdUser -Replace @{'extensionAttribute1' = 'Vendor'}
Then you can create a dynamic distribution group based on ConditionalCustomAttribute1, which maps to extensionAttribute1 in AD.
New-DynamicDistributionGroup -Name "Vendor Dynamic Group" -IncludedRecipients "MailboxUsers" -ConditionalCustomAttribute1 "Vendor"
Note that you can query for more than one value since -ConditionalCustomAttribute1 accepts an array. So you could pass -ConditionalCustomAttribute1 "Vendor","Contractor", which would look for the values Vendor or Contractor in extensionAttribute1.
--If the reply is helpful, please Upvote and Accept as answer--
Hi, is this statement still accurate ?
Because i'm facing same but didn't find ExtensionAttribute anymore, in on-prem AD, cloudExtensionAttribute instead.
Is it the same ?
Sorry for post's exhumation