remove particular email address from Bulk distribution Group

Addy Nadia
Addy Nadia used Ask the Experts™
on
Hello Team,

We have exchange 2013, need to remove @abc.xyz.com from Secondary address and uncheck the email address policy

this need to be done for bulk Distribution Groups, i have email address of those groups

Please suggest the script

thanks,
Addy
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Addy NadiaExpert

Author

Commented:
now i only need to remove the @abc.xyz.com from the distribution Group i have names of all distribution in CSV

please suggest command as per that.

script in artile looks very typical
AmitIT Architect
Distinguished Expert 2017

Commented:
How many DL's you need to fix? If no too many, just do it manually.

Commented:
The easiest way would be to create a .csv file containing two columns entitled Primary and Secondary.  List the PrimarySmtpAddress under the Primary column and the associated @abc.xyz.com email address in the Secondary column.  Save the .csv file to your desktop as groups.csv and then run this script from EMS:

Import-Csv "$env:USERPROFILE\Desktop\groups.csv" | ForEach-Object {
  Set-DistributionGroup $_.primary -EmailAddresses @{remove="$_.secondary"} -EmailAddressPolicyEnabled $false
}

Open in new window

It would be wise to start with just one Distribution Group in the .csv file to gauge results and adjust as needed prior to running the entire batch.
Addy NadiaExpert

Author

Commented:
The first article helped me for my question..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial