Remove SMTP addresses from All users

I have a Domain of about 200+ users with Exchange 2007.  I have about 6 or 7 different E-mail domains.  We are working on switching names to a new Single domain.

I made a mistake and Added the wrong domain to Exchange and also created a e-mail address policy to push out the wrong domain name to all the users.  I have now added the correct domain and removed the wrong domain but the addresses still show up under each user.  How can I remove this from the users?

The Domain was lwspas.com and should have been lwspa.com

kwitcomAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aissimCommented:
You could check out this program called ADModify; great for making bulk changes in active directory:
http://www.codeplex.com/admodify/Release/ProjectReleases.aspx?ReleaseId=6065

Here's the short of it.....start ADModify; select all the necessary users in your domain; you'll be shown a window similar to the user properties you'd see in ADUC; switch to the E-Mail Addresses tab; tick and configure the box labeled 'Remove E-mail Address'....in your case it would be something like "smtp:*@lwspas.com"

But post back if you run into questions.
0
aissimCommented:
crap.....I'm sorry - just realized Exchange 2007....that probably won't work =)

When you say you removed the wrong domain, how did you do so? Did you use the Remove-EmailAddressPolicy command in the EMS?
0
bnditCommented:
Hello kwitcom,

Believe it or not I've done the same thing before...here's how I fixed my situation:

1) I used LDIFDE to export the proxyAddresses for all users in AD. Here's the command "c:\>ldifde -f <path_location> -s <domain_controller> -d "OU=<your_OU>,DC=<your_domain>,DC=<your_domain>" -r "(objectClass=user)" -l "dn,proxyaddresses"
        Example: Extract proxyaddress from the Finance OU in the contoso.com domain
        c:\>ldifde -f c:\userExport.ldf -s DC1 -d "OU=Finance,DC=contoso,DC=com" -r "(objectClass=user)" -l "dn,proxyAddresses"

The userExport.ldf file will look like this when you open it with notepad:

dn: CN=Administrator,CN=Users,DC=contoso,DC=com
changetype: add
proxyAddresses: SMTP:Administrator@contoso.com
proxyAddresses: X400:c=US;a= ;p=contoso Org;o=Exchange;s=Administrator;
proxyAddresses: smtp:postmaster@contoso.com

dn: CN=Jae Pak,CN=Users,DC=contoso,DC=com
changetype: add
proxyAddresses: X400:c=US;a= ;p=contoso Org;o=Exchange;s=Pak;g=Jae;
proxyAddresses: SMTP:Jae@contoso.com

2) Now, I'll assume that your email policy created the SMTP for your 200+ users. Open the .ldf file created in step #1 and do a "Save As" to make a copy of it. Use the "replace" option in notepad to replace the wrong domain with the correct domain as well as change the "changetype" value to "modify". Also, you'll need to add a line containing "replace: proxyAddresses" and a hyphen (-) followed by a blank line at the end of each user. In this example, I'll replace "contoso" with "abc". (NOTE: I use mail merge in MS Word to add the "-" and the "blank" line) Here's the formatted file that will correct the SMTP address for our users:

dn: CN=Administrator,CN=Users,DC=abc,DC=com
changetype: modify
replace: proxyAddresses
proxyAddresses: SMTP:Administrator@abc.com
proxyAddresses: X400:c=US;a= ;p=abc Org;o=Exchange;s=Administrator;
proxyAddresses: smtp:postmaster@abc.com
-

dn: CN=Jae Pak,CN=Users,DC=abc,DC=com
changetype: modify
replace: proxyAddresses
proxyAddresses: X400:c=US;a= ;p=abc Org;o=Exchange;s=Pak;g=Jae;
proxyAddresses: SMTP:Jae@abc.com
-

NOTE: Rember that the "replace:" line, the hyphen "-", and the "blank" line are important parameters for a successful change. Also notice that I only modified and added to this file and didn't not remove anything.

3) Once you've used notepad to make the changes above, you'll need to import the file back into AD. Here's the syntax:
c:\>ldifde -i -f<path_location> -s <domain_controller>
Example:    c:\>ldifde -i -f c:\import.ldf -s DC1

Again, this is only my opinion to solve your issue. I've fixed my issue this way before, and I'm comfortable with LDIFDE. If you're comfortable with this tool, go ahead and give it a shot. However, if you've never used and feel uncomfortable, I would recommend you find a different way of approaching the problem.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tdwg98Commented:
You can use:
adfind

adfind -default -rb ou=recipient -f (proxyaddresses=smtp:*@test.com) -mvfilter proxyaddresses=@test.com proxyaddresses -adcsv | admod proxyaddresses:-:{{proxyaddresses}} -unsafe

For more info, see the link below:
http://blog.joeware.net/2006/11/19/718
0
AMCUserCommented:
ADModify worked perfectly!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.