Issues creating dynamic distribution group with PowerShell

I am trying to create a DDG with the following filters: Mailbox Users, specific OU and not member of a certain group. This script works fine (minus the exclusion):
New-DynamicDistributionGroup -Name "1Test1" -RecipientContainer "OU=ABC,DC=xyz,DC=com" -IncludedRecipients 'MailBoxUser'
\When I change the script to exclude members of the group the DDG is blank:
New-DynamicDistributionGroup -Name "1Test1" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (MemberOfGroup -ne "CN=1ExcludeDynamic,OU=ExchangeGroups,DC=xyz,DC=com") -and (RecipientContainer -eq "OU=ABC,DC=xyz,DC=com")}
Any ideas will be appreciated.

All right. That's a good thing. Now create another new DDL using the Powershell cmdlet and the values you got from the "RecipientFilter" and "RecipientContainer" properties. Then verify that you get the same results as you do when you ran this on the one
you created with the GUI:
Get-DynamicDistributionGroup
'NewGroup' | fl Name,RecipientContainer,RecipientFilter,LdapRecipientFilter
and
$g=Get-DynamicDistributionGroup NewGroup
(Get-Recipient
-RecipientPreviewFilter $g.RecipientFilter
-OrganizationalUnit $g.RecientContainer).count
If you do, then run a Get-DynamicDistributionGroup GROUPNAME | Set-Dynamic -RecipientFilter
{(RecipientType -eq 'UserMailbox') -and (MemberOfGroup -ne "CN=1ExcludeDynamic,OU=ExchangeGroups,DC=xyz,DC=com")}
Then see if it works as expected. If it doesn't try this:
Get-DynamicDistributionGroup GROUPNAME | Set-Dynamic -RecipientFilter {(RecipientType -eq 'UserMailbox') -and -not (MemberOfGroup -eq "CN=1ExcludeDynamic,OU=ExchangeGroups,DC=xyz,DC=com")}
--- Rich Matheisen MCSE&I, Exchange MVP

Similar Messages

  • Create dynamic distribution group from 2 or more OU ?

    How I can create Dynamic distribution group from 2 or more OU ?
    I tried modified solution from this post:
    http://social.technet.microsoft.com/Forums/office/en-US/11a338b9-dbca-4378-9cda-4590a5b8d0f7/exclude-specific-ou-or-user-from-dynamic-distribution-groups?forum=exchangesvrgenerallegacy
    but I'm not sure will this work.

    Hi,
    I have some tests in my environment using Exchange 2013. I use the following cmdlet to create a dynamic distribution group through multiple OUs, but it can't work as I expect.
    New-DynamicDistributionGroup -Name "Users with mobile phones" -Alias "usermobile" -RecipientFilter{(((recipienttype -eq 'usermailbox') -and (MobilePhone -ne $null) -and ((RecipientContainer -eq 'contoso.com/users') -or (RecipientContainer -eq 'contoso.com/test
    OU'))) )}
    Actually, we have a dedicated support team regarding the Microsoft Scripts. I recommend you ask your question on our Microsoft Scripts forum which is staffed by more experts specializing in this kind of problems. Thanks for your understanding.
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Create Dynamic Distribution Groups Using Customized Filters

    I am looking to create a new Dynamic Distribution List. 
    Example: 
    DL - United States Users ([email protected]
    In AD we have the 'Office' field filled accordingly, which contains the attribute USCA___ or USIL (US,California,etc or US, Illinois,etc). 
    I was wanting to try creating these using this command/script; 
    New-DynamicDistributionGroup -Name "DL - United States Users" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (Office -eq 'USCA*')(Office -eq 'USIL*')}
    Assistance here please: 
    1. What needs to be added in that line so that only certain users can email to it, rejecting all others (i.e. The Helpdesk or Corporate Communications)
    2. Is there a way to specify the SMTP address you want it to use? 
    3. Is there a way to have it only add mailboxes that are enabled in AD so disabled mailbox user accounts wont be added? 
    Thanks in advance everyone. 

    Hi,
    We can use the following command to create a Dynamic distribution group:
    New-DynamicDistributionGroup -Name "DL - United States Users" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (Office -like
    'US, California' -or (Office -like 'US, Illinois')) -and (UserAccountControl -ne 'AccountDisabled, NormalAccount')}
    Then as what ED says, we can use the Set-DynamicDistributionGroup cmdlet with AcceptMessagesOnlyFrom or
    AcceptMessagesOnlyFromDLMembers parameter to specify certain users who can send email messages to this dynamic distribution group. And use PrimarySMTPAddress parameter to specify the primary return SMTP email address for the distribution group.
    Hope it helps.
    Thanks,
    Winnie Liang
    TechNet Community Support

  • Creating Dynamic Radio Groups with HTMLDB_ITEM

    Hi,
    I'm using HTMLDB (1.5.1.00.12) and attempting to create a Dynamic Radiogroup using the HTMLDB_ITEM package in a PL/SQL region. (It's not known until runtime whether a radiogroup should appear on the page.) I normally call to HTMLDB_ITEM and htp.p the results to the screen.
    If I was creating this radiogroup using a normal Page Item: Active/Inactive. I usually define a list of values as: STATIC:Active;A,Inactive;I
    How can I do this with HTMLDB_ITEM package, and get both radiobuttons to appear on the same line next to each other? Unfortunately this function doesn't have a p_query I can pass values to. I'm sure I'm overlooking something obvious so I'm hoping some fresh perspective on this will help.
    Thanks in advance!

    Hi Patrick,
    Thank you for your reply I have done this as follows.
    function getTermdetailsQuerySuccsess(sender, args) {
      var listEnumerator = Termsitems.getEnumerator();
      // var datatable = document.getElementById("TermList");
      var i =0;
      while (listEnumerator.moveNext()) {
       i=i+1;
       var Question = listEnumerator.get_current().get_item('Title');
       var QuestionNumbers = listEnumerator.get_current().get_item('questionnumber');
       if (QuestionNumbers == 1) {
       $("#questiontable1 tbody").append("<tr>");
       $("#questiontable1 tbody").append("<td align='left'>"+ Question +" </td>");
       $("#questiontable1 tbody").append("<td align='Center'><input type='radio' name='question1Radio"+i+"' id='Question1Radio"+i+"'></td>");
       $("#questiontable1 tbody").append("<td align='Center'><input type='radio' name='question1Radio"+i+"' id='Question1Radio"+i+"'></td>");
       $("#questiontable1 tbody").append("<td align='Center'><input type='radio' name='question1Radio"+i+"' id='Question1Radio"+i+"'></td>");
       $("#questiontable1 tbody").append("<td align='Center'><input type='radio' name='question1Radio"+i+"' id='Question1Radio"+i+"'></td>");
       $("#questiontable1 tbody").append("<td align='Center'><input type='radio' name='question1Radio"+i+"' id='Question1Radio"+i+"'></td>");
       $("#questiontable1 tbody").append("<td align='Center'><input type='radio' name='question1Radio"+i+"' id='Question1Radio"+i+"'></td>");
       $("#questiontable1 tbody").append("<td align='Center'><input type='text' name='question1Text"+i+"' id='Question1Text"+i+"'></td>");
       $("#questiontable1 tbody").append("</tr>");
    d.n weerasinghe

  • Regarding Dynamic distribution Group filtering! - URGENT HELP

    Hello Friends,
    We have some employess in our company having primary SMTP address as
    [email protected] as well as [email protected] as alias name.
    I want to create Dynamic distribution group using recipient filter option.. I have tried various option.. nothing is worked out. can you please someone help on how to do this?
    NOTE: I can able to filter using EMC filter : using "emailadresses" + "contains" @company2.com.......
    Karthick

    Your requirement is unclear. reply back with what you are actually looking for!
    if you want to use -RecipientFilter to Create/Manage Dynamic Distribution Groups then below are the few links which has the information about the values that you may use for -RecipientFilter
    Filterable properties for the -RecipientFilter parameter
    Filters
    in recipient Shell commands
    Using
    PowerShell to Manage Dynamic Distribution Groups and Recipient Filters in Exchange Server
    Create
    Dynamic Distribution Groups Using Customised Filters
    M.P.K ~ ( Exchange | 2003/2007/2010/E15(2013)) ~~ Please remember to click “Vote As Helpful" if it really helps and "Mark as Answer” if it answers your question, “Unmark as Answer” if a marked post does not actually answer your question. ~~ This
    Information is provided is "AS IS" and confers NO Rights!!

  • Set Send to permissions on distribution groups through powershell

    We have an Exchange 2013 environment on which we have created distribution groups with powershell.
    However I can't figure out how we can configure the "send to" permissions for these distribution groups.
    What we want is for Exchange to look at CustomAttribute3 in a user account, and if that attribute meets the set requirements the user will have permission to send mail to this distribution group.
    Can anyone help me with this issue? Is there a powershell command I can use to configure this?
    kind regards,
    kevin

    Hi kevin,
    You can use the following cmdlet to configure the distribution group to accept messages only from the specific users.
    Set-DistributionGroup -Identity "DGName" -AcceptMessagesOnlyFrom "xxx","xxx"
    What's more, I am afraid that the -AcceptMessagesOnlyFrom parameter does not accept the custom attribute. Your understanding will be appreciated.
    For your reference:
    https://technet.microsoft.com/en-us/library/bb124955(v=exchg.150).aspx
    Hope this can be helpful to you.
    Best regards,
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Amy Wang
    TechNet Community Support

  • Dynamic Distribution Groups question

    Can I create a dynamic distribution group based on Exchange Custom Attributes, specifically extensionAttribute6? I haven't used dynamic distribution groups yet, but now we have a need.

    Hello,
    Yes, it is possible. You can create dynamic distribution group using ConditionalCustomAttribute6 parameter: http://technet.microsoft.com/en-us/library/bb125127(v=exchg.150).aspx.

  • Create/Edit "Custom Attributes" in Dynamic Distribution Groups

    Hi,
    I wanna create a Dynamic Distribution Group based on the users "title" and "company".
    I've noticed that there are 15 "Custom Attributes" that I can edit in someway, I guess via PowerShell?
    So what is the easiest way to accomplice this?

    Hi,
    Agree with the above suggestion, you can also bulk change the custom attributes:
    Get-Mailbox -ResultSize Unlimited -Database Execs | Set-Mailbox -CustomAttribute1 “title”
    http://dougg.co.nz/2012/05/01/bulk-setting-exchange-2010-custom-attributes/
    to Edit Custom Attributes:
    get-mailbox -filter {customattribute1 -eq ""} | set-mailbox -customattribute1 = "<value>"
    And here is a reference about Create/Edit "Custom Attributes" in Dynamic Distribution Groups:
    http://windowsitpro.com/exchange-server-2010/exchange-2010-sp2-value-custom-attributes
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make
    sure that you completely understand the risk before retrieving any suggestions from the above link.
    Best regards,
    Angela Shi
    TechNet Community Support

  • Create new dynamic distribution group as filter office location

    Hi
    I want to create new dynamic distribution group as filter office location. So  I would like to request you please suggest the script through Power shell or graphical interface.
    In case you need more clarification please revert back.
    Regards
    Md Ehteshamuddin khan 

    If you don't use OUs to separate your users and use the 'Office' field in Active Directory you can create Dynamic lists for this property as well.
    The Office field, which stores its information in the physicalDeliveryOfficeName attribute of the object, can be referenced to create a list by using this PowerShell command:
    New-DynamicDistributionGroup -Name <LIST NAME> -RecipientFilter {office -eq '<OFFICE NAME OR LOCATION>'} -RecipientContainer '<LOCATION OF USERS ALLOWED IN THE LIST>' -OrganizationalUnit '<LOCATION OF WHERE LIST WILL BE STORED IN ACTIVE
    DIRECTORY' -Alias 'LIST ALIAS'
    Tested and verified with Exchange 2010

  • Help with dynamic distribution group exclusion

    Hi all,
    Having a strange trouble with a dynamic distribution group filtering on the user being a member of a particular group
    Recipient Filter  is:
    ((((((((RecipientType -eq 'UserMailbox') -and (-not(Title -like '[]*')))) -and (MemberOfGroup -ne 'CN =ExcludeFromMoitorigList,OU=Mail Redirect,OU=System Accounts,OU=New Objects,DC=test,DC=local'))) -and (-not(UserAccountControl -eq 'AccountDisabled, NormalAccount, DoNotExpirePassword')))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))
    If I make a preview of this distribution list I get expected result. Users included in ExcludeFromMoitorigList group don't appear. But they continue receive emails sent to dynamic distribution group.
    Any help is much appreciated

    I'm not sure what all of the settings you are adding are for, but operating under the assumption that they are necessary, try this:
    ((((RecipientType -eq 'UserMailbox') -and (-not(Title -like '[]*')) -and (-not(MemberOfGroup -eq 'CN =ExcludeFromMoitorigList,OU=Mail Redirect,OU=System Accounts,OU=New Objects,DC=test,DC=local')))) -and (-not(UserAccountControl -eq 'AccountDisabled, NormalAccount, DoNotExpirePassword')))
    If that doesn't work, try this:
    ((RecipientType -eq 'UserMailbox') -and (-not(Title -like '[]*')) -and (-not(MemberOfGroup -eq 'CN =ExcludeFromMoitorigList,OU=Mail Redirect,OU=System Accounts,OU=New Objects,DC=test,DC=local')) -and (-not(UserAccountControl -eq 'AccountDisabled, NormalAccount, DoNotExpirePassword')))
    FYI, the reason for those suggestions is because I got this working on Exchange 2013 running on Server 2012 Datacenter by taking the existing RecipientFilter and adding the -not MemberOfGroup section, but noticed that all of this was then duplicated:
    -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'))
    As such, I re-created it without that, and that's what I've done with your string.  I also changed the -ne to a -not(-eq) and in the second example, got rid of some extra parenthesis that I'm not sure you need.
    Also, note that in my working scenario, I used this command and put the filter I was setting where I have indicated <filter> (I left the double quotes in the command):
    Set-DynamicDistributionGroup -Identity <Group> -RecipientFilter "<filter>"

  • Create separate dynamic distribution groups for each UPNs domain

    Hi All,
    we have several UPNs in our Domain and need to create separate distribution groups for each UPNs.
    the command that I used is,
    new-dynamicdistributiongroup -name GroupName -RecipientFilter {(UserPrincipalName -like‘*@connect.test.local’)}
    but this returns an error saying "Exception setting "RecipientFilter": "Invalid filter syntax"
    what is the exact way of creating distribution group in O365 by filtering the UPN domain name?
    Many thanks

    Hi All,
    we have several UPNs in our Domain and need to create separate distribution groups for each UPNs.
    the command that I used is,
    New-DynamicDistributionGroup -Name "All Students" -Alias "All_Students"  -PrimarySmtpAddress "[email protected]" -RecipientFilter {(UserPrincipalName -like ‘*@connect.test.local’)}
    new-dynamicdistributiongroup -name AllStudents  -RecipientFilter {(UserPrincipalName -like '*@connect.test.local')} 

  • Dynamic Distribution Group set conditions by importing text file?

    Exchange 2010 SP2.
    I created a dynamic distribution group via the EMC.  We have populated AD with ExtenstionAttribute1 and ExtensionAttribute2.  I have created the ddg with custom attribute1 value = employee.  What I need to do now is  populate custom attribute
    2 = 00-0001, 00-0002, and so on.  There are about 300 of these numbers I need to add.  I have them in a text file or csv file.  Instead of adding them one by one in the EMC, is there a way to import them via powershell to the existing ddg? 
    The ddg is called All Management Employees.

    If they go from 00-0001 to 00-0300, you could just add them as follows:
    Set-DynamicDistributionGroup <group name> -RecipientFilter "(CustomAttribute1 -eq 'employee') -and (CustomAttribute2 -like '00-0*')"
    However, if you have additional items like this (such as 00-0350, etc), you may need to use the following:
    Set-DynamicDistributionGroup <group name> -RecipientFilter "(CustomAttribute1 -eq 'employee') -and ((CustomAttribute2 -like '00-00*') -or (CustomAttribute2 -like '00-01*') -or (CustomAttribute2 -like '00-02*') -or (CustomAttribute2 -eq '00-00300')"
    Now, if your numbering isn't sequential and it can't be, you would need to add them individually - which may make your search filter unusable, in which case, you may need to create several dynamic groups and add them to a parent group.

  • Dynamic Distribution Group - RecipientContainer ignored

    When i set the container in powershell and confirm that the setting took I then run the preview filter. It is for sure pulling from out side the OU that I set in the container parm. 
    Any help on this issue?
    Proactive security not reactive, lets make it happen.

    Hi,
    From your description, you set the RecipientContainer when you create the dynamic distribution group, but actually it doesn't work. If I have misunderstood your concern, please let me know. In your case, I recommend you take your time to post the cmdlet
    you use for my further research.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Dynamic Distribution Group on HOSTED exchange 2010 not setting up properly

    Hi all,
    We have a hosted exchange 2010, which prevents us from using the EMC.
    I want to create a simple dynamic distribution group for every staff member in the organization but am facing a problem. I use the following command:
    New-DynamicDistributionGroup -Organization "organizationname" -IncludedRecipients MailboxUsers -Name "Office"
    This appears to work according to shell. In addition,
    Get-DynamicDistributionGroup -Organization "organizationname"
    DOES come up with "office" as a listing (though the "Managed by" field is empty. Should I care?)
    However:
    sending to that address creates a bounce-back "no such email address"
    a look in AD shows that the object has been created somewhat incorrectly
    It appears that while a group is nominatively created no email address is created attached to it (which should be [email protected]).
    I am by no means a shell expert and have been bumping my head for a few days now, any suggestion would be great!
    Thanks in advance,
    Rodolphe

    Hey, thanks for your reply Willard.
    Everything looks correct:
    name: Office
    Alias: Office
    PrimarySmtpAddress: [email protected]
    EmailAddressPolicyEnabled: False
    The bounceback now is quoting a permissions issue
    #< #5.7.1 smtp;550 5.7.1 RESOLVER.RST.AuthRequired; authentication required> #SMTP#
    This actually gives me the clues to resolve:
    When creating a distribution group through the EMC, by default it is "closed" so only members of that DDL can send to it. I have tested this by sending to it from an internal address and it does go through.
    Set-DynamicDistributionGroup <name> -RequireSenderAuthenticationEnabled $False
    resolves the issue to allow external senders.
    Thanks for your help Willard, your question was enough to get me going in the right direction. Hopefully some other newbie will find this useful in the future.

  • Dynamic Distribution Group - Moderator approval fails

    hi,
    (On premise and office365 Exchange)
    we use the above in our organization. we have some dynamic groups created. I have a moderator for a couple of groups. when a user sends an email to one of the group that has a moderator, the latter gets an email to either approve or reject the message. when
    he/she clicks on the accept button they get the following error:
    Delivery has failed to these recipients or groups:
    Microsoft Exchange Approval Assistant
    Your message wasn't delivered because the recipient's email provider rejected it.
    Diagnostic information for administrators:
    Generating server: DB4PR07MB0701.eurprd07.prod.outlook.com
    SystemMailbox{d57a4133-7e21-486e-9917-f7fb70dc2cdb}@XXXXXX.onmicrosoft.com
    Remote Server returned '< #5.7.12 smtp;550 5.7.12 RESOLVER.RST.SenderAuthenticated; Delivery restriction check failed as sender not authenticated>'
    Original message headers:
    Received: from AMXPR07CXXXXX.eurprd07.prod.outlook.com (10.242.64.XX) by
    DB4PR07XXXXX.eurprd07.prod.outlook.com (10.141.45.XX) with Microsoft SMTP
    Server (TLS) id 15.1.6.9; Fri, 31 Oct 2014 14:20:41 +0000
    Received: from DB3FFO11XXXXX.protection.gbl (2a01:111:f400:7e04::130) by
    AMXPR07CXXXXX.outlook.office365.com (2a01:111:e400:1000::20) with Microsoft
    SMTP Server (TLS) id 15.1.11.14 via Frontend Transport; Fri, 31 Oct 2014
    14:20:41 +0000
    Received: from XXXXX.XXXXX.co.ke (197.220.102.XXX) by
    DB3FFO11FD053.mail.protection.outlook.com (10.47.217.XXX) with Microsoft SMTP
    Server (TLS) id 15.0.1049.20 via Frontend Transport; Fri, 31 Oct 2014
    14:20:40 +0000
    Received: from XXXXX.XXXXX.co.ke (192.168.11.XXX) by
    XXXXX.XXXX.co.ke (192.168.11.XXX) with Microsoft SMTP Server (TLS) id
    15.0.847.32; Fri, 31 Oct 2014 17:20:37 +0300
    Received: from XXXXX.XXXXX.co.ke ([fe80::4b9:1080:7301:f8be]) by
    XXXX.XXXXX.co.ke ([fe80::4b9:1080:7301:f8be%15]) with mapi id
    15.00.0847.xxx; Fri, 31 Oct 2014 17:20:37 +0300
    From: "XXXXX XXXXX " <[email protected]>
    To: Microsoft Exchange Approval Assistant
            <SystemMailbox{d57a4133-7e21-486e-9917-f7fb70dc2cdb}@XXXXX.onmicrosoft.com>
    Subject: Approve: * QUOTE OF THE DAY *
    Thread-Topic: * QUOTE OF THE DAY *
    Thread-Index: Ac/1FciNlxJwVzCBTJKjqDyb/OnY+gAAAOtxAAAChkA=
    Date: Fri, 31 Oct 2014 14:20:37 +0000
    Message-ID: <[email protected]>
    Accept-Language: en-US
    Content-Language: en-US
    X-MS-Has-Attach:
    X-MS-TNEF-Correlator:
    x-originating-ip: [192.168.1.XXX]
    Content-Type: text/plain; charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable
    MIME-Version: 1.0
    Return-Path: [email protected]
    X-EOPAttributedMessage: 0
    X-Forefront-Antispam-Report: CIP:197.220.102.xxx;CTRY:KE;IPV:NLI;EFV:NLI;
    X-OriginatorOrg: XXXXX.onmicrosoft.com
    X-Microsoft-Antispam: UriScan:;
    X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DB4PR07xxxxx;
    Kind Regards, Khuzema R.

    Hi Khuzema,
    Please confirm if your Dynamic Distribution Group is created on-promise and the moderator is on the Office365 Exchange.
    If the Dynamic Distribution Group and the moderator are in different Exchange servers: On-premise and Online, please open the Dynamic Distribution Group in EAC, then check
    Senders inside and outside of my organization in delivery management to have a try.
    If it doesn’t work, I suggest we can change a moderator who is in the same mailbox server with the Dynamic Distribution Group to check whether the issue persists.
    Regards,
    Winnie Liang
    TechNet Community Support

Maybe you are looking for