Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2015-01-09
4
Medium Priority
?
416 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 1000 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 1000 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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
In this video we show how to create an Address List 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 Organization >> Ad…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

719 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