Wednesday , June 10 2020

Remove Distribution Groups from a list Contains in CSV file

Got a small request on removing multiple Distribution groups from a csv file

image

Just get the CSV file in the Above format

Import-Csv C:\RemoveDG.csv

make sure CSV file is in the below format

image

Now Run

Import-csv C:\RemoveDG.csv | foreach{Remove-distributiongroup $_.RemoveDG}

image

It removes the Distribution groups containing in the CSV file

Use -Confirm Switch if you want to avoid prompts

To Disable Distribution Groups from a list Contains in CSV file

Import-csv C:\RemoveDG.csv | foreach{Disable-distributiongroup $_.RemoveDG}

Thank you

About Satheshwaran Manoharan

Satheshwaran Manoharan is an Microsoft Office Server and Services MVP , Publisher of Azure365pro.com. Specialized in Office365 / Microsoft Exchange / Virtualization , Sathesh is an Messaging Expert supporting/Designing/Deploying many medium size businesses to large enterprises when it comes to Corporate messaging and Virtualization Infrastructure

Check Also

Export all Teams Channels and all members in Office 365

In some situations like if we wish to study a new environment or restructure a …

Leave a Reply

Your email address will not be published.