Link to home
Start Free TrialLog in
Avatar of shamilt1
shamilt1Flag for United States of America

asked on

Powershell script to bulk add email to distribution lists and set as primary for 365 online

Here is the deal.

We have company that would like to add the new domain name and change the primary email address for all users to a new domain they have purchased. It has been added to  365 online. They would also like to do the same for distribution lists.

 I have found a script that will do so for mailboxes at the following site :
http://exchangeserverpro.com/powershell-script-create-mailbox-size-report-exchange-server-2010/

This works well in our test env.

Contoso.com also has many distribution lists. Is there another script that will allow me to do the same for distribution lists in bulk? I was only able to find scripts to do so one at a time. See script syntax below.


Set-DistributionGroup "<Distribution Group Name>" -EmailAddresses SMTP:<Primary Email>,<Alias Email>
ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There is no need to do this via a script. If this is a new domain they have purchased and they want to use tihs as their primary SMTP Address then all you need to do is the following...

- create a new accepted domain for this domain i.e. newname.com
- update the default email address policy with the new domain name (referencing the accepted domain)
- apply the policy to the mailboxes and distribution groups

This would be a preferred method rather than a script because if you use a script when you create new mailboxes they will get the old email address from the default email address policy.

Will.
Avatar of shamilt1

ASKER

This helps, saves the step of having to add alias email address in the script, thanks.