Need your input how to achieve these conditions ( dynamic distribution group )

365 Test Tenant 11 Reputation points
2022-11-29T21:59:33.85+00:00

Create a dynamic distribution list that reads the user's company name and user Mailbox. Dynamic distribution list should include only enabled user mailbox accounts. Any blocked accounts should be automatically excluded from the dynamic distribution list. Any assistance will be much appreciated.

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,746 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Alfredo Revilla - Upwork Top Talent | IAM SWE SWA 27,491 Reputation points
    2022-11-30T04:45:55.073+00:00

    Hello @365 Test Tenant and thanks for reaching out. Out of the box, is not possible to exclude disabled accounts in Exchange Dynamic Distribution Groups since the AccountDisabled attribute is not a recognized filterable property. You can, however, set the account disabled value to one of the Exchange Custom Attributes, all which are filterable, so that you can achieve the same desired result. Setting the value to a custom attribute would preferably be done by a scheduled job or similar.

    E.g.

    Updating the custom attribute
       Connect-ExchangeOnline  
       Get-User -RecipientTypeDetails "UserMailbox" | % {Set-Mailbox -Identity $_ -CustomAttribute1 $_.AccountDisabled }  
    
    Creating the Dynamic Distribution Group
       Connect-ExchangeOnline  
       New-DynamicDistributionGroup -ConditionalCompany <COMPANY> -ConditionalCustomAttribute1 "False" # Extra parameters  
    

    Let us know if you need additional assistance. If the answer was helpful, please accept it and complete the quality survey so that others can find a solution.

    0 comments No comments

  2. Aholic Liang-MSFT 13,861 Reputation points Microsoft Vendor
    2022-12-01T08:04:29.217+00:00

    Hi @365 Test Tenant

    What is blocked accounts? Are you referring to mailboxes without licenses?
    If so ,please don’t worry it .If the mailbox has been unlicensed, it should be converted to a shared mailbox .
    So you can refer to the following command to create a dynamic distribution group with company name and user mailbox as conditions.

    New-DynamicDistributionGroup -Name "contoso group” -RecipientFilter "(RecipientType -eq 'UserMailbox')  -and (Company -like 'contoso' )"  
    

    About how to create dynamic distribution group in Exchange Online, you could refer to the following links:

    Manage dynamic distribution group in Exchange Online | Microsoft Learn
    New-DynamicDistributionGroup (ExchangePowerShell) | Microsoft Learn
    For more filters, please see the following link:
    Filterable properties for the RecipientFilter parameter | Microsoft Learn


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.