Link to home
Start Free TrialLog in
Avatar of cawasaki
cawasaki

asked on

Powershell Script to modify primary SMTP adress and external adress for a contact in Exchange 2007

Hi,

I need a powershell script who can check a file with a list of user, for exemple this file:

John.smith
Jimmy.drick
sandra.mickeal
susane.langlish


All this user is a contact in my exchange 2007.

I need to modify all primary SMTP adress of this contact with this domain: newdomaine.com
I need also modify external adress of the contact to the same domain: newdomaine.com

I need to keep older smtp adress as secondary SMTP adress.

The script mast change all user contained in my txt or csv file.

For exemple the script must change John.smith@olddomain.com primary smtp to John.smith@newdomain.com
the script must also change external adress of the contact from John.smith@olddomain.com  to John.smith@newdomain.com

Thanks for your help
Avatar of meagain35
meagain35

Have you considered using the built-in email address policy settings for managing this?

http://www.msexchange.org/articles_tutorials/exchange-server-2007/management-administration/managing-email-address-policies.html

Avatar of cawasaki

ASKER

Hi,

It a contact not mailbox.

I just need a script to modify an existing contact like descripted.

thanks

This should be like what you are looking for:

Get-MailContact -Identitiy yourcontact@domain.local | SetMailContact -PrimarySmtpAddress "yourcontact@newdomain.local"


Here is another post with the same issue.

http://social.technet.microsoft.com/Forums/en/exchangesvradmin/thread/fa94c2eb-3259-4788-883e-abeb5ed0956b



ok

this is a powershell command i need and teest it for 1 account:

Get-MailContact -Identitiy John.smith | Set-MailContact -PrimarySmtpAddress "John.smith@newdomain.com"

after this, i lunch:

Get-MailContact -Identitiy John.smith | Set-MailContact -ExternalEmailAddress "John.smith@newdomain.com"

OK, can you help my to put all this in 1 command and use a file with a list of contact to modify?

thanks
ASKER CERTIFIED SOLUTION
Avatar of GusGallows
GusGallows
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Gus -

Elegant :)
Wow thanks GusGallows, its work for 2 account i tested.

I retest tomorow with 10 account and report the result.

thanks :)
Hey Cawasaki. How did the rest of your testing go?
hey, sorry, your script is very good, i close this question :)