Avatar of DebelloCaminus
DebelloCaminusFlag for United States of America asked on

Exchange 2007 SP2 Setting up New DynamicDistributionGroup - command shell

Trying to set up a new dynamic distribution group, but keep getting syntax errors.  Not sure if my parenthesis are in the correct order or the { }.  Below is an example of one of the variations I've tried.


New-DynamicDistributionGroup -Name "trend" -OrganizationalUnit "Business.com/Locations" -RecipientFilter {(RecipientType -eq 'UserMailbox' -and (Title -like '*Trend*' -or Title -like '*Desktop*') –and –not(Name –like ‘SystemMailbox{*’) –and –not(Name –like ‘CAS_{*’))}

Receive message:
New-DynamicDistributionGroup : Cannot bind parameter 'RecipientFilter' to the t
arget. Exception setting "RecipientFilter": """ is not a valid operator. For a
list of supported operators see the command help.
"(RecipientType -eq 'UserMailbox' -and (Title -like '*Trend*' -or Title -like '
*Desktop*') -and -not(Name -like `SystemMailbox{*') -and -not(Name -like `CAS_{
*'))" at position 91."
At line:1 char:110

Avatar of undefined
Last Comment
Will Szymkowski

8/22/2022 - Mon
Will Szymkowski

Based on your syntax you are missing the "$_." on all of your attributes i.e.$_.RecipientType.

Should look something like that below...

New-DynamicDistributionGroup -Name "trend" -OrganizationalUnit "Business.com/Locations" -RecipientFilter {$_.RecipientType -eq 'UserMailbox' -and $_.Title -like '*Trend*' -or $_.Title -like '*Desktop*') –and –not $_.Name –like "SystemMailbox{*" –and –not $_.Name –like 'CAS_{*'

Made a few adjustments to the brackets...

Still getting error:

New-DynamicDistributionGroup : Cannot bind parameter 'RecipientFilter' to the t
arget. Exception setting "RecipientFilter": "Invalid filter syntax. For a descr
iption of the filter parameter syntax see the command help.
"$_.RecipientType -eq 'UserMailbox' -and $_.Title -like '*Trend*' -or $_.Title
-like '*Desktop*'" at position 1."
At line:1 char:110
+ New-DynamicDistributionGroup -Name "trend" -OrganizationalUnit "business.com/Locations" -RecipientFilter <<<<  {$_.RecipientType -eq 'UserMailbox' -and
 $_.Title -like '*Trend*' -or $_.Title -like '*Desktop*'} -and -not $_.Name -li
ke "SystemMailbox{*" -and -not $_.Name -like 'CAS_{*'
    + CategoryInfo          : WriteError: (:) [New-DynamicDistributionGroup],
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.Exchange.Manage
Will Szymkowski

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thank you...that worked!!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Will Szymkowski

Perfect glad to help!