Bulk Delete Group Members

Modified on Tue, 30 Jun at 3:11 PM

#Parameters

$CSVFilePath = "C:\Temp\Bulk-DL.csv"

 

Try {

    #Connect to Exchange Online

  

 

    #Get Data from CSV and Create Distribution List

    Import-CSV $CSVFilePath | ForEach {

        New-DistributionGroup -Name $_.Name -PrimarySmtpAddress $_.Email -Type $_.Type -Members $_.Members.split(",")

        Write-host -f Green "Created Distribution List:"$_.Name

    }

}

Catch {

    write-host -f Red "Error:" $_.Exception.Message

}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article