Solved

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

Posted on 2015-01-09
4
199 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 18

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now