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.

i.e.:

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
DebelloCaminusAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
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_{*'
0
DebelloCaminusAuthor Commented:
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],
   ParameterBindingException
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.Exchange.Manage
   ment.RecipientTasks.NewDynamicDistributionGroup
0
Will SzymkowskiSenior Solution ArchitectCommented:
My apologize as I was thinking of a different powershell switch. The syntax will also be incorrect. Please take a look a this link and follow the "RecipientFilter" syntax that is outlined in Example 2.

http://technet.microsoft.com/fr-fr/library/bb125127(v=exchg.150).aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DebelloCaminusAuthor Commented:
Thank you...that worked!!
0
Will SzymkowskiSenior Solution ArchitectCommented:
Perfect glad to help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.