locked
Dynamic Distribution Group help RRS feed

  • Question

  • The CustomAttribute properties on the mailboxes are a numerical value from 1 to 100.  The recipient filter is coded as such on the dynamic distribution group:    (CustomAttribute1 -le '10')

    But this is not working correctly and returning all recipients without filtering them.  I believe this is happening because the "CustomAttribute" property on the recipient is a string, and therefore the -le, ge, lt, gt operators do not work correctly on the string.  Does anybody know how to perform a -le operator filter on a string ? so that I could have a dynamic distribution group that can display recipients that have a CustomAttribute1 value of less than 10 ?

    Friday, September 30, 2016 8:03 PM

Answers

  • The CustomAttribute1 field is populated with a number, not text.

    That attribute is always populated with a string because it is defined in AD as such. That in your case the string might evaluate to an integer, is purely coincidental. Worse still, the OPATH language does not do RegEx matching so can't use that either.

    That said, for -le 10 you could use

    (CustomAttribute1 -eq 0) -or (CustomAttribute1 -eq 1) -or (CustomAttribute1 -eq 2) -or (CustomAttribute1 -eq 3) -or (CustomAttribute1 -eq 4) -or (CustomAttribute1 -eq 5) -or (CustomAttribute1 -eq 6) -or (CustomAttribute1 -eq 7) -or (CustomAttribute1 -eq 8) -or (CustomAttribute1 -eq 9) -or (CustomAttribute1 -eq 10)
    Just don't let the boundary grow any further ;-)


    Evgenij Smirnov

    msg services ag, Berlin -> http://www.msg-services.de
    my personal blog (mostly German) -> http://it-pro-berlin.de
    Windows Server User Group, Berlin -> http://www.winsvr-berlin.de
    Mark Minasi Technical Forum, reloaded -> http://newforum.minasi.com

    In theory, there is no difference between theory and practice. In practice, there is.


    • Edited by Evgenij Smirnov Saturday, October 1, 2016 6:14 PM
    • Proposed as answer by Lynn-Li Monday, October 3, 2016 8:32 AM
    • Marked as answer by Lynn-Li Monday, October 10, 2016 10:02 AM
    Saturday, October 1, 2016 6:13 PM

All replies

  • Hi

    So what exactly you wanted to achieve, plz elaborate further.

    Regards.

    H.Shakir

    Friday, September 30, 2016 8:11 PM
  • for example, Create a Dynamic Distribution Group that will send emails only to those recipients with a CustomAttribute1 field that is less than or equal to "10"

    The CustomAttribute1 field is populated with a number, not text.

    Friday, September 30, 2016 8:17 PM
  • The CustomAttribute1 field is populated with a number, not text.

    That attribute is always populated with a string because it is defined in AD as such. That in your case the string might evaluate to an integer, is purely coincidental. Worse still, the OPATH language does not do RegEx matching so can't use that either.

    That said, for -le 10 you could use

    (CustomAttribute1 -eq 0) -or (CustomAttribute1 -eq 1) -or (CustomAttribute1 -eq 2) -or (CustomAttribute1 -eq 3) -or (CustomAttribute1 -eq 4) -or (CustomAttribute1 -eq 5) -or (CustomAttribute1 -eq 6) -or (CustomAttribute1 -eq 7) -or (CustomAttribute1 -eq 8) -or (CustomAttribute1 -eq 9) -or (CustomAttribute1 -eq 10)
    Just don't let the boundary grow any further ;-)


    Evgenij Smirnov

    msg services ag, Berlin -> http://www.msg-services.de
    my personal blog (mostly German) -> http://it-pro-berlin.de
    Windows Server User Group, Berlin -> http://www.winsvr-berlin.de
    Mark Minasi Technical Forum, reloaded -> http://newforum.minasi.com

    In theory, there is no difference between theory and practice. In practice, there is.


    • Edited by Evgenij Smirnov Saturday, October 1, 2016 6:14 PM
    • Proposed as answer by Lynn-Li Monday, October 3, 2016 8:32 AM
    • Marked as answer by Lynn-Li Monday, October 10, 2016 10:02 AM
    Saturday, October 1, 2016 6:13 PM
  • It seems explicitly defining each option with the -eq operator is the only way that works.

    Is there a way to edit an existing RecipientFilter without having the system automatically re-add the

     (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')


    The problem is if I get the recipient filter string and edit it and then simply try to pipe it back into a Set-DynamicDistributionGroup -RecipientFilter  command, it adds duplicate entries of the CAS and SystemMailbox exclusions and makes it a bit messy.

    Example,

    Get-DynamicDistributionGroup ddl | select -ExpandProperty recipientfilter

     Outputs:

    ((CustomAttribute1 -le '5') -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetails
    Value -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')) -and (-not(RecipientTypeDetails
    Value -eq 'AuditLogMailbox')))

    So I copy this to notepad and simply change the -le '5' statement to -eq '5' and use SET command to apply the change

    Set-DynamicDistributionGroup -RecipientFilter {((CustomAttribute1 -eq '5') -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetails
    Value -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')) -and (-not(RecipientTypeDetails
    Value -eq 'AuditLogMailbox')))}


    But when you review the filter you can see that it automatically appended my string with the exclusions for discovery mailbox, arbitration mailbox etc. again.  Is there a way to apply a change to recipient filter without it automatically re-adding the system mailbox exclusions ?

    ((((((((((((((((CustomAttribute1 -le '5') -and (-not(Name -like 'SystemMailbox{*')))) -and (-not(Name -like 'CAS_{*')))) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')))) -and (-not(
    RecipientTypeDetailsValue -eq 'DiscoveryMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))) -and
    (-not(RecipientTypeDetailsValue -eq 'AuditLogMailbox')))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -
    and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')) -
    and (-not(RecipientTypeDetailsValue -eq 'AuditLogMailbox')))

    Sunday, October 2, 2016 9:11 PM
  • In my experience, this is always the case. So I simply keep a copy of my filter in an excel spreadsheet to edit and then upload.

    Yehoshua | RHCT - RHEL5 | MCSE - 2K3 | MCTS - Exchange 2007 | MCTS - Vista - Configuration | MCDST

    • Proposed as answer by Joshua Wortz Monday, October 3, 2016 2:08 PM
    Monday, October 3, 2016 2:59 AM
  • In my experience, this is always the case. So I simply keep a copy of my filter in an excel spreadsheet to edit and then upload.
    Alternatively, (I have seen someone do it but can't really say how well it worked ;-) ) you can keep a list of auto-added clauses in an array and remove them before adding your own. But apart from that no, there isn't a 'magic button'.

    Evgenij Smirnov

    msg services ag, Berlin -> http://www.msg-services.de
    my personal blog (mostly German) -> http://it-pro-berlin.de
    Windows Server User Group, Berlin -> http://www.winsvr-berlin.de
    Mark Minasi Technical Forum, reloaded -> http://newforum.minasi.com

    In theory, there is no difference between theory and practice. In practice, there is.

    Monday, October 3, 2016 6:50 AM