Link to home
Get AccessLog in
Avatar of Andy Andy
Andy AndyFlag for India

asked on

remove particular email address from Bulk distribution Group

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
ASKER CERTIFIED SOLUTION
Avatar of viktor grant
viktor grant
Flag of Belgium image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of Andy Andy

ASKER

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
How many DL's you need to fix? If no too many, just do it manually.
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.
The first article helped me for my question..