none
Dynamic Distribution Group using '-RecipientFilter' command

    Question

  • Okay, I am trying to create a custom dynamic distribution group using the command below. The syntax is taken basically verbose from the technet site.

    New-DynamicDistributionGroup -Name AllBaltimore -OrganizationalUnit gill-simpson.com/GSI Users –RecipientFilter { ((RecipientType –eq 'UserMailbox') –and (Company –eq 'Gill-Simpson, Inc.') –and (Office –eq 'Baltimore')) }

    However, I keep getting the following error message in the command shell...

    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 (Company -eq 'Gill-Simpson, Inc.') -and (Office -eq 'Baltimore')) " at position 17."

    At line:1 char:112

    + New-DynamicDistributionGroup -Name AllBaltimore -OrganizationalUnit gill-simpson.com/GSI Users -RecipientFilter  <<<< { ((RecipientType-eq 'UserMailbox') -and (Company -eq 'Gill-Simpson, Inc.') -an

    Does anyone know why I'm getting this? I've searched all of microsoft but can't seem to find any solution that works.

     

    Tuesday, November 06, 2007 4:56 PM

Answers

  • This has been resolved by another source.  The problem was in the syntax of the command.  The original syntax was taken directly from Microsoft and TechNet’s online documentation and sample code.  This however, is shown incorrectly on the site. The problem was in the use of parenthesis between the ‘Company’ and ‘Office’ attributes (see syntax above). For this to work from the command shell no parenthesis should be between these two attributes. The proper syntax is as follows:

     

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

     

    Hope this helps if anyone else has ran into this problem,

    Thursday, November 08, 2007 5:37 PM

All replies

  • Have you looked here: http://technet.microsoft.com/en-us/library/aa996561.aspx

     

    I just tried this, and it seemed to work for me.  Maybe leave out the full path to your OU?

     

     

    [PS] C:\Documents and Settings\administrator\Desktop>New-DynamicDistributionGroup -Name All
    Baltimore -OrganizationalUnit gsiusers -RecipientFilter {((RecipientType -eq 'UserMailbox'))}

                                                                                                  

    Name                                    ManagedBy                               
    ----                                    ---------                                            
    AllBaltimore                                                                         


    [PS] C:\Documents and Settings\administrator\Desktop>

    Tuesday, November 06, 2007 5:10 PM
  • I tried running what you put in.....that also works for me; however, when I add the properties for 'Company' and 'Office' into the command it fails with the same error.  The Property names are exactly what is listed on the filterable properties so I must have some other syntax issue.

     

    [PS] C:\Documents and Settings\melvoyzeyadmin1115\Desktop>New-DynamicDistributionGroup -Name AllBaltimore -OrganizationalUnit "GSI Users" -RecipientFilter {((RecipientType -eq 'UserMailbox'))}

    Name                                                                                                ManagedBy
    ----                                                                                                ---------
    AllBaltimore


    [PS] C:\Documents and Settings\melvoyzeyadmin1115\Desktop>New-DynamicDistributionGroup -Name AllbeBaltimore -OrganizationalUnit "GSI Users" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and (C
    ompany -eq 'Gill-Simpson, Inc.') -and (Office -eq 'Baltimore'))}

    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 comma
    nd help.
    "((RecipientType -eq 'UserMailbox') -and (Company -eq 'Gill-Simpson, Inc.') -and (Office -eq 'Baltimore'))" at position 36."
    At line:1 char:99
    + New-DynamicDistributionGroup -Name AllbeBaltimore -OrganizationalUnit "GSI Users" -RecipientFilter  <<<< {((RecipientType -eq 'UserMailbox') -and (Company -eq 'Gill-Simpson, Inc.') -and (Office -eq
     'Baltimore'))}
    [PS] C:\Documents and Settings\melvoyzeyadmin1115\Desktop>

    Tuesday, November 06, 2007 5:53 PM
  • Okay, I've narrowed it down to the fact that if I insert an -and operator into the statement if fails.  Can anyone else create a group using the -and operator in the statement?

    Wednesday, November 07, 2007 12:58 PM
  • This has been resolved by another source.  The problem was in the syntax of the command.  The original syntax was taken directly from Microsoft and TechNet’s online documentation and sample code.  This however, is shown incorrectly on the site. The problem was in the use of parenthesis between the ‘Company’ and ‘Office’ attributes (see syntax above). For this to work from the command shell no parenthesis should be between these two attributes. The proper syntax is as follows:

     

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

     

    Hope this helps if anyone else has ran into this problem,

    Thursday, November 08, 2007 5:37 PM