Solved

Bulk change of external email addresses for Mail Contacts - Exchange 2007

Posted on 2015-01-09
4
265 Views
Last Modified: 2015-01-15
Assuming this is going to need powershell.

We have a LOT of mail contacts in the form of user@abc.com. abc.com is changing to xyz.zom so we want to be able to identify and change all of them. Invididually would be a problem.

Can anyone help with necessary commands to to do this?
0
Comment
Question by:paul williams
4 Comments
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 40539977
0
 

Author Comment

by:paul williams
ID: 40540073
Thanks but first I need to know how to get a list of contacts with abc.com as their smtp email address before I can change them.
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 250 total points
ID: 40540303
Use the following powershell scripts to accomplish exactly what you need.

import-module activedirectory
add-pssnapin microsoft.exchange.management.powershell.admin
Get-MailContact -resultsize "unlimited" | select Alias | out-file "c:\mailcontacts.csv"

Open in new window


This will give you all of the mail contacts in your environment, and export them to a CSV file.

From there do the following...
- open the CSV remove the second line -----------------------------
- create a second column called NewAddress
- make sure that the CSV file is constructed like below...
Alias             NewAddress
bobprince   bprice@xyz.com
etc...

Then use the next powershell script to change each ExternalEmailAddress respectively...
import-module activedirectory
Add-PSSnapin microsoft.exchange.management.powershell.admin
$UserList = import-csv "c:\mailcontacts.csv"
foreach ($Contact in $UserList) {
$Contact.Alias
$Contact.NewAddress
Get-MailContact -Identity $Contact.Alias | Set-MailConact -ExternalEmailAddress $Contact.NewAddress -Confirm:$False
}

Open in new window


This will then go through the csv and modify each mail contact respectively.

Will.
0
 
LVL 9

Assisted Solution

by:schmiegu
schmiegu earned 250 total points
ID: 40546085
You only need this one line:
Get-MailContact -ResultSize Unlimited | Where {$_.WindowsEmailAddress -match 'abc.com' } | Foreach {Set-MailContact $_.WindowsEmailAddress  $_.WindowsEmailAddress  -Replace "abc" "xyz"}

Open in new window


To first check the contacts:
Get-MailContact -ResultSize Unlimited | Where {$_.WindowsEmailAddress -match 'abc.com' } | ft Name, Alias, WindowsEmailAddress 

Open in new window

0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question