question

GlennMaxwell-2309 avatar image
0 Votes"
GlennMaxwell-2309 asked ·

Remove DL members

Hi All

i have users list in csv file, i want to remove users from the DL, will the below syntax help me.
users
user1@contoso.com
user2@contoso.com

Import-CSV C:\list.csv | ForEach {Remove-DistributionGroupMember -Identity distributionlist@contoso.com -Member $_.users}

office-sharepoint-onlineoffice-exchange-online-itprooffice-online-server-generaloffice-online-server-exchange
10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ChelseaWu-MSFT avatar image
0 Votes"
ChelseaWu-MSFT answered ·

I have tested and confirm that the command works fine for removing DL members.

If you want to skip the built-in confirmation prompt while executing the command, use this exact syntax: -Confirm:$false:

 Import-CSV C:\list.csv | ForEach { Remove-DistributionGroupMember -Identity distributionlist@contoso.com -Member $_.users -Confirm:$false}

Reference: Remove-DistributionGroupMember.


If an Answer is helpful, please click "Accept Answer" and upvote it.
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.

10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

michev avatar image
0 Votes"
michev answered ·

Yes, it should work just fine, assuming you have a column called "Users" in your CSV file.

10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.