27.8 C
Dubai
Friday, December 2, 2022

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

Satheshwaran Manoharan
Satheshwaran Manoharanhttps://www.azure365pro.com
Specialized in Microsoft Azure - Office 365 / Microsoft Exchange; conducted numerous projects worldwide in designing, supporting, and implementing messaging and virtualization infrastructure for medium-sized and large enterprises. Further, I am a Cloud Architect and Technical Advisor for various start-ups.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

× How can I help you?