Distribution Lists

Roger Roger 5,446 Reputation points
2022-04-21T02:34:29.297+00:00

Hi All

i have two requirements.

i have a csv file with DL lists in the below format. i have two users user1@Company portal .com and user2@Company portal .com i want to remove existing DL owners by importing the csv file and make user1 and user2 as DL owners. For any DL in the csv file, if there are no owners defined then user1 and user2 should be made DL owners.

dls
dl1@Company portal .com
dl2@Company portal .com

i have a csv file with DL lists in the below format. i have two users user1@Company portal .com and user2@Company portal .com i want to make user1 and user2 as DL owners. if there exists DL owners they should remain as DL owners and user1 and user2 should be added as an additional DL owners. For any DL in the csv file, if there are no owners defined then user1 and user2 should be made DL owners.

dls
dl3@Company portal .com
dl4@Company portal .com

Can the same be achieved for office365 unified groups as well?

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,378 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,496 questions
{count} votes

Accepted answer
  1. Kael Yao-MSFT 37,676 Reputation points Microsoft Vendor
    2022-04-22T02:33:17.297+00:00

    Hi @Roger Roger

    i have a csv file with DL lists in the below format. i have two users user1@Company portal .com and user2@Company portal .com i want to remove existing DL owners by importing the csv file and make user1 and user2 as DL owners. For any DL in the csv file, if there are no owners defined then user1 and user2 should be made DL owners.

    The csv file would be like:

    identity  
    dl1@contoso.com  
    dl2@contoso.com  
    

    The script would be like:

    import-csv C:\temp\1.csv | foreach {  
    	Set-DistributionGroup -identity $_.identity -ManagedBy user1,user2  
    }  
    

    i have a csv file with DL lists in the below format. i have two users user1@Company portal .com and user2@Company portal .com i want to make user1 and user2 as DL owners. if there exists DL owners they should remain as DL owners and user1 and user2 should be added as an additional DL owners. For any DL in the csv file, if there are no owners defined then user1 and user2 should be made DL owners.

    The csv file would be like:

    identity  
    dl3@contoso.com  
    dl4@contoso.com  
    

    The script would be like:

    import-csv C:\temp\1.csv | foreach {  
        	Set-DistributionGroup -identity $_.identity -ManagedBy @{Add="user3","user4"}  
        }  
    

    Can the same be achieved for office365 unified groups as well?

    To manage Office 365 groups, you may need to use Add-UnifiedGroupLinks instead.


    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.


0 additional answers

Sort by: Most helpful