Answered by:
How to edit multiple mail contact with EMS

Question
-
Hi,
I need to change few hundred mail contact(external e-mail address) because their provider has changed domain name. I have this situation:- example01@domain.com
- example02@domain.com
- example03@domain.com
- ...
and I need change to:
- example01@something.com
- example02@something.com
- example03@something.com
- ....
I tried with command Set-MailContact but only for single edit. Windows Server 2008R2 SP1 and Exchange 2010 SP1 is my configuration.
I have solution with other tools, but with EMS I get stuck.
Monday, May 30, 2011 7:49 AM
Answers
-
Thank you mjolinor, you helped me alot, but your script doesnt work for me without litle edit(first I tried to correct typing errors but anyway first part of script isn't working). This is tested and working script:
$contacts = Get-MailContact -Filter {ExternalEmailAddress -like '*domain.com*'} $contacts | foreach-object {$_ | set-mailcontact -externalemailaddress ($_.externalemailaddress.proxyaddressstring -replace "domain.com","something.com")}
- Marked as answer by rajco Friday, June 10, 2011 3:24 PM
Friday, June 10, 2011 3:23 PM
All replies
-
The easiest and probably fastest way would be to
(1) Export your Contacts from the EMC (or from the EMS if you have experience with Export-Csv)
(2) Do a search and replace in Notepad
(3) Delete the Contacts with the EMC
(4) Import the Contacts with the EMS (PowerShell)
How to Import CSV Contacts to Exchange 2010
http://msgsense.com/2011/01/20/how-to-import-csv-contacts-to-exchange-2010/The alternative would be to use sting manipulation in PowerShell within a loop.
The String’s the Thing
http://technet.microsoft.com/en-us/library/ee692804.aspx
MCTS: Messaging | MCSE: S+MMonday, May 30, 2011 8:14 AM -
I was thinking about this idea, but if I delete all contacts how to know which contact was in which distribution group? Thank you for link, I will check this tip.
Monday, May 30, 2011 8:23 AM -
Sorry for being immodest ... you could use my script:
PowerShell command to list all distribution groups and members of those groups
http://social.technet.microsoft.com/Forums/en/exchangesvradmin/thread/63ad55d1-1393-4533-8065-1d7cbd8657faBut perhaps sting manipulation would be a better idea in that case.
MCTS: Messaging | MCSE: S+M- Proposed as answer by Terence Yu Tuesday, May 31, 2011 1:28 AM
- Marked as answer by Terence Yu Friday, June 10, 2011 8:16 AM
- Unmarked as answer by rajco Friday, June 10, 2011 3:32 PM
Monday, May 30, 2011 9:20 AM -
Hi,
Can we do it in EMC?
Thanks.
Tuesday, May 31, 2011 6:48 AM -
Thank you John for replay and excellent link. I am away this week and on Monday I will test this script and inform you about results.Tuesday, May 31, 2011 9:57 PM
-
I think this will work:
$contacts = get-mailcontact | where-object {$_.externalemailadderss.addressstring -match "domain\.com"}
$contacts | foreach-object {
$_ | set-mailcontact -externalemailaddress ($_.externalemailaddress.proxyaddressstring -replace "domain\.com","something.com")
}
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "Tuesday, May 31, 2011 11:26 PM -
Thank you mjolinor, you helped me alot, but your script doesnt work for me without litle edit(first I tried to correct typing errors but anyway first part of script isn't working). This is tested and working script:
$contacts = Get-MailContact -Filter {ExternalEmailAddress -like '*domain.com*'} $contacts | foreach-object {$_ | set-mailcontact -externalemailaddress ($_.externalemailaddress.proxyaddressstring -replace "domain.com","something.com")}
- Marked as answer by rajco Friday, June 10, 2011 3:24 PM
Friday, June 10, 2011 3:23 PM