Looking for a Powershell cmdlet to change Contacts email addresses
I'd like to make some bulk changes to some Contacts in Specific OUs. I'd like to remove any email addressese that have a certain domain name ending as well as un check the "Automatically update e-mail addressed based on e-mail address policy" option. Is there an easy way to do this? Orange County District Attorney
March 10th, 2009 1:49am

Hi Sandy, You need to write a powershell script to do this. I wrote a sample script for you but didn't get chance to test it. Suggest you to test it in your test environment first and make necessary changes and run in production environment. $contacts=Get-MailContact-OrganizationalUnit"subdomain.contoso.com/contacts"-ResultSizeUnlimited|where{$_.emailaddresses-like"*@olddomain.com"} ForEach($contactIn$contacts) { $found=0 for($i=0;$i-lt$contact.EmailAddresses.Count;$i++) { $address=$contact.EmailAddresses[$i] if($address.SmtpAddress-like"*@olddomain.com") { $contact.EmailAddresses.RemoveAt($i) $found=1 } } IF($found-eq1) { $contact|set-mailcontact set-mailcontact$contact-EmailAddressPolicyEnabled$false } }Amit Tank | MVP - Exchange | MCITP:EMA MCSA:M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2009 6:40am

The threads below will also help as workaround: Mail Contacts and Default E-mail address Policy 2007 Default Email Address Policy Applying to Mail Contacts Notes: For questions about script please use the Development Forum which would be the most relevant forum for the question
March 10th, 2009 9:04am

Thanks very much Amit. This is a great start and will get me going! Orange County District Attorney
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2009 5:20pm

You are welcome!!JPlease consider James's response in case you are trying to remove the smtp addressesof your internal domain namewhich are stampped by EAP.Amit Tank | MVP - Exchange | MCITP:EMA MCSA:M | http://ExchangeShare.WordPress.com
March 10th, 2009 5:28pm

Yes, I'm taking a look at it now. ADModify looks like it could do what I need without a script. Thanks a bunch!Orange County District Attorney
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2009 5:29pm

Yes, ADModify.net is a great tool to do bulk modification on AD objects with the power of GUI. Just make sure that you have latest version of it to run on Exchange 2007 mailboxes.Amit Tank | MVP - Exchange | MCITP:EMA MCSA:M | http://ExchangeShare.WordPress.com
March 10th, 2009 5:35pm

I located two copies of Admodify.net from a Microsoft PSS ftp siteftp.microsoft.com/PSS/Tools/Exchange%20Support%20Tools/ADModifybut they are both from 2004. Do you happen to know if there are any newer versions than the 1.6 or 2.x versions out there? Orange County District Attorney
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2009 5:48pm

You can grab the latest one from here.ADModify.NET Latest BuildWed Feb 18 2009 at 8:00 AMhttp://codeplex.com/admodify Looks like the site is giving intermediate problem and could not be loaded (or at least to me...)Amit Tank | MVP - Exchange | MCITP:EMA MCSA:M | http://ExchangeShare.WordPress.com
March 10th, 2009 5:56pm

Thanks! Yes, I had the same problem with the link but I was able to bring the page up with www.codeplex.com and then searched for admodify and got the latest build. I had used this tool back in our Exchange 5.5 days but I've forgotten how really cool this thing is and how easy it is to do bulk changes. This is just what we need. I do want, however, to get more practice and familiarity with Powershell so I will work with your script also - that looks to do the same also. Thanks again!Orange County District Attorney
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2009 6:04pm

One more thing, I'd like to see if I can "exempt" a set of OUs from getting stamped by any EAP that I have. Is there a way to do this so that no matter how a Contact is created, if I put it in a certain OU, no EAP will apply? I've noticed this cmdletGet-MailContact -OrganizationalUnit "xx xx" | Set-MailContact EmailAddressPolicyEnabled:$falseThis appears to change any 'existing' Contacts, but I'd like to somehow 'stamp' an OU with this information. Orange County District Attorney
March 10th, 2009 6:47pm

Well, I guess there isn't any straight forward way (unless you change default EAP to exclude specific OU with-RecipientFilterparameterto stamp EAP, which I don't recommend or do it after solid testing in test environment) to set it for new contacts automatically and you need to go with the work aound mentioned by Allen Song in James' link, create a dummy accepted domain, add a dummy email address policy for the contacts which will be created in perticuler OU.Amit Tank | MVP - Exchange | MCITP:EMA MCSA:M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2009 7:18pm

I believe I have a solution that will work for me. We've created a EAP that we've specified that it only applies to User Mailboxes and that appears to only apply itself to Mailbox Objects. I'm currently changing all my current Contacts to not apply any policies. I think this will work for us. Thanks again!Orange County District Attorney
March 10th, 2009 7:21pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics