Link to home
Create AccountLog in
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.

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
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

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_{*'
Avatar of DebelloCaminus

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thank you...that worked!!
Perfect glad to help!