Share via

Distribution Lists

Roger Roger 7,631 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?

Exchange Online
Exchange Online

A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.

Exchange | Exchange Server | Management
Exchange | Exchange Server | Management

The administration and maintenance of Microsoft Exchange Server to ensure secure, reliable, and efficient email and collaboration services across an organization.


Answer accepted by question author

Kai Yao 37,791 Reputation points Moderator
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  
******@contoso.com  
******@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  
******@contoso.com  
******@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.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

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