How to edit multiple mail contact with EMS
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.
May 30th, 2011 10:49am
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.aspxMCTS: Messaging | MCSE: S+M
Free Windows Admin Tool Kit Click here and download it now
May 30th, 2011 11:14am
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.
May 30th, 2011 11:23am
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-1d7cbd8657fa
But perhaps sting manipulation would be a better idea in that case.MCTS: Messaging | MCSE: S+M
Free Windows Admin Tool Kit Click here and download it now
May 30th, 2011 12:20pm
Hi,
Can we do it in EMC?
Thanks.
May 31st, 2011 9:48am
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.
Free Windows Admin Tool Kit Click here and download it now
June 1st, 2011 12:57am
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 " "
June 1st, 2011 2:26am
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")}
Free Windows Admin Tool Kit Click here and download it now
June 10th, 2011 6:23pm