New-DynamicDistributionGroup : Cannot bind parameter 'RecipientFilter' to the target

Sune picture Sune · Oct 2, 2012 · Viewed 7.1k times · Source

I try to run the following command:

New-DynamicDistributionGroup -Name "All Company Office"
-OrganizationalUnit 'domain/A1/Distribution Groups'
-RecipientFilter {((RecipientType -eq 'UserMailbox')
-and (Office -eq 'Fornebu')
–and (Company -eq 'Broadnet'))}
-RecipientContainer 'domain/A1/Users'

But I get the following error:

New-DynamicDistributionGroup : Cannot bind parameter 'RecipientFilter' to the target.
Exception setting "RecipientFilter": """ is not a valid operator. For a list of
supported operators see the command help.
"((RecipientType -eq 'UserMailbox') -and (Office -eq 'Fornebu') –and (Company -eq 
'Broadnet'))" at position 64."

At line:1 char:140
+ New-DynamicDistributionGroup -Name "_TESTDG Alle Broadnet Fornebu" 
-OrganizationalUnit 'corp.local/A1/Distribution Groups' -RecipientFilter <<<<  
{((RecipientType -eq 'UserMailbox') -and (Office -eq 'Fornebu')
–and (Company -eq 'Broadnet'))} -RecipientContainer 'corp.local/A1/Users'
+ CategoryInfo          : WriteError: (:) [New-DynamicDistributionGroup],
ParameterBindingException
+ FullyQualifiedErrorId :
ParameterBindingFailed,Microsoft.Exchange.Management.RecipientTasks.NewDynamicDistributionGroup

I've tried "the google" to no avail. Please help:) (using powershell 2.0 by the way)

Answer

vinny picture vinny · Oct 2, 2012

This alludes to the filter having a problem with your parentheses. Try this instead:

-RecipientFilter {((RecipientType -eq 'UserMailbox') -and (Office -eq 'Fornebu' -and Company -eq 'Broadnet'))}