21.1 C
Dubai
Monday, March 4, 2024

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
Award-winning Technology Leader with a wealth of experience running large teams and diversified industry exposure in cloud computing. From shipping lines to rolling stocks.In-depth expertise in driving cloud adoption strategies and modernizing systems to cloud native. Specialized in Microsoft Cloud, DevOps, and Microsoft 365 Stack and conducted numerous successful projects worldwide. Also, Acting as a 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?