4 comments on “Dynamic Distribution Groups

  1. This exchange 2010 script should create dynamic distribution groups of user names based on the first letter in their last name:

    new-dynamicdistributiongroup -name GRP-LastName-AtoD -RecipientFilter {(RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “a*@*”) -or (UserPrincipalName -like “b*@*”) -or (UserPrincipalName -like “c*@*”) -or (UserPrincipalName -like “d*@*”))}

    new-dynamicdistributiongroup -name GRP-LastName-EtoH -RecipientFilter {(RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “e*@*”) -or (UserPrincipalName -like “f*@*”) -or (UserPrincipalName -like “g*@*”) -or (UserPrincipalName -like “h*@*”))}

    new-dynamicdistributiongroup -name GRP-LastName-ItoL -RecipientFilter {(RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “i*@*”) -or (UserPrincipalName -like “j*@*”) -or (UserPrincipalName -like “k*@*”) -or (UserPrincipalName -like “l*@*”))}

    new-dynamicdistributiongroup -name GRP-LastName-MtoP -RecipientFilter {(RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “m*@*”) -or (UserPrincipalName -like “n*@*”) -or (UserPrincipalName -like “o*@*”) -or (UserPrincipalName -like “p*@*”))}

    new-dynamicdistributiongroup -name GRP-LastName-QtoU -RecipientFilter {(RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “q*@*”) -or (UserPrincipalName -like “r*@*”) -or (UserPrincipalName -like “s*@*”) -or (UserPrincipalName -like “t*@*”) -or (UserPrincipalName -like “u*@*”))}

    new-dynamicdistributiongroup -name GRP-LastName-VtoZ -RecipientFilter {(RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “v*@*”) -or (UserPrincipalName -like “w*@*”) -or (UserPrincipalName -like “x*@*”) -or (UserPrincipalName -like “y*@*”) -or (UserPrincipalName -like “z*@*”))}

  2. This exchange 2010 script should create dynamic distribution groups of user names based on the first letter in their last name:

    Corrected Syntax below

    new-dynamicdistributiongroup -name GRP-LastName-AtoD -RecipientFilter {((UserPrincipalName -like “a*”) -or (UserPrincipalName -like “b*”) -or (UserPrincipalName -like “c*”) -or (UserPrincipalName -like “d*”))}

    new-dynamicdistributiongroup -name GRP-LastName-EtoH -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “e*”) -or (UserPrincipalName -like “f*”) -or (UserPrincipalName -like “g*”) -or (UserPrincipalName -like “h*”)))}

    new-dynamicdistributiongroup -name GRP-LastName-ItoL -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “i*”) -or (UserPrincipalName -like “j*”) -or (UserPrincipalName -like “k*”) -or (UserPrincipalName -like “l*”)))}

    new-dynamicdistributiongroup -name GRP-LastName-MtoP -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “m*”) -or (UserPrincipalName -like “n*”) -or (UserPrincipalName -like “o*”) -or (UserPrincipalName -like “p*”)))}

    new-dynamicdistributiongroup -name GRP-LastName-QtoU -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “q*”) -or (UserPrincipalName -like “r*”) -or (UserPrincipalName -like “s*”) -or (UserPrincipalName -like “t*”) -or (UserPrincipalName -like “u*”)))}

    new-dynamicdistributiongroup -name GRP-LastName-VtoZ -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “v*”) -or (UserPrincipalName -like “w*”) -or (UserPrincipalName -like “x*”) -or (UserPrincipalName -like “y*”) -or (UserPrincipalName -like “z*”)))}

  3. Corrected Syntax below:

    This exchange 2010 script should create dynamic distribution groups of user names based on the first letter in their last name:

    new-dynamicdistributiongroup -name GRP-LastName-AtoD -RecipientFilter {((UserPrincipalName -like “a*”) -or (UserPrincipalName -like “b*”) -or (UserPrincipalName -like “c*”) -or (UserPrincipalName -like “d*”))}

    new-dynamicdistributiongroup -name GRP-LastName-EtoH -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “e*”) -or (UserPrincipalName -like “f*”) -or (UserPrincipalName -like “g*”) -or (UserPrincipalName -like “h*”)))}

    new-dynamicdistributiongroup -name GRP-LastName-ItoL -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “i*”) -or (UserPrincipalName -like “j*”) -or (UserPrincipalName -like “k*”) -or (UserPrincipalName -like “l*”)))}

    new-dynamicdistributiongroup -name GRP-LastName-MtoP -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “m*”) -or (UserPrincipalName -like “n*”) -or (UserPrincipalName -like “o*”) -or (UserPrincipalName -like “p*”)))}

    new-dynamicdistributiongroup -name GRP-LastName-QtoU -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “q*”) -or (UserPrincipalName -like “r*”) -or (UserPrincipalName -like “s*”) -or (UserPrincipalName -like “t*”) -or (UserPrincipalName -like “u*”)))}

    new-dynamicdistributiongroup -name GRP-LastName-VtoZ -RecipientFilter {((RecipientType -eq ‘UserMailbox’) -and ((UserPrincipalName -like “v*”) -or (UserPrincipalName -like “w*”) -or (UserPrincipalName -like “x*”) -or (UserPrincipalName -like “y*”) -or (UserPrincipalName -like “z*”)))}

  4. Hello,

    I created a few DDLs in the console and have been using ADSI Edit to modify their queries in the msExchQueryFilter field.

    I have got as far as getting the below query to work;
    ((((CustomAttribute14 -eq ‘Osram’) -and (CustomAttribute15 -eq ‘AMERICAS’) -and (Co -eq ‘Canada’) -and (Alias -ne $null))) -and (-not(Name -like ‘SystemMailbox{*’)) -and (-not(Name -like ‘CAS_{*’)))

    But I need to exclude mailboxes that are hosted on our archive server (employees tend to leave and then return with some frequency).

    After reviewing the list of fields here: https://technet.microsoft.com/en-us/library/bb738157(v=exchg.150).aspx I have attempted to patch both of the below snippets into my query to no avail.

    -and (ServerName -not ‘ARCHIVE’)
    -and (HiddenFromAddressListsEnabled –eq ‘$false’)

    I’d much prefer to exclude the server, but made the attempt to exclude hidden mailboxes out of desperation.

    I can’t really say that I speak Opath yet, but I’m making the attempt.
    Could you please point out to me where I’m being dumb?

Leave a Reply

Your email address will not be published. Required fields are marked *