Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I safely remove unused secondary domain from 500+ mailboxes ?

Posted on 2013-01-25
12
Medium Priority
?
720 Views
Last Modified: 2013-01-28
Hi, I have removed my secondary domain in my exchange server organizational configurations http://technet.microsoft.com/en-us/library/bb124423(v=exchg.80).aspx 

But somehow it is still appearing in all of the mailboxes in my domain ?

Any idea please to safely remove it from the production mailbox?
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 16

Expert Comment

by:choward16980
ID: 38820869
I'm assuming < exchange 2003?  

Remove the domain from any recipient update policies and user accounts.  Or remove from recipient update policies and 'apply this policy now'
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 38820895
I'm on exchange server 2007 SP1
0
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 500 total points
ID: 38820927
Try this..
Import-Csv Email.csv | % {
$user = Get-Mailbox $_.SMTP
$user.emailAddresses -= $_.Oldsmtp
Set-Mailbox $user -emailAddresses $user.emailAddresses
}

Open in new window

Sample CSV format
SMTP,Oldsmtp
bob.smith@xyz.com,bsmith@sym.com
john.smith@xyz.com,jsmith@sym.com
joe.brown@xyz.com,jbrown@sym.com

Open in new window

Code will remove bsmith@sym.com from mailbox bob.smith@xyz.com
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 63

Assisted Solution

by:Simon Butler (Sembee)
Simon Butler (Sembee) earned 500 total points
ID: 38821724
Another option would be to use admodify - that should remove the entries for youa s well.

Exchange 2007 SP1 is very old BTW, no longer supported in fact. You should look at upgrading to Exchange 2007 SP3 plus the latest rollup as soon as possible.

Simon.
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 38821927
Thanks for the reply Sembee,

admodify  --> what is that and can I do that automatically for all mailbox in the office ?

Yes I know, as long as it is still running and no issue, I keep it that way, I am afraid to break something if I'm upgrading it into SP3 RU 8
0
 
LVL 63

Expert Comment

by:Simon Butler (Sembee)
ID: 38822041
Is Google broken today?
admodify - in your favourite search engine and it will come up as the first hit. It allows bulk changes to the Active Directory.

You are going to have more problems staying on such an old version. The world moves on, staying so out of date because you are scared you are going to break something is not really a good attitude to have. If the server is exposed to the internet in any way then you are putting your data at risk by not keeping it up to date. Hopefully you don't have the same attitude to patching of other systems. That may seem harsh, but I clean up so many sites where system maintenance has not been carried out and they wonder why they have problems. Standing still in the current IT security environment is not an option unless you are completely 100% isolated from the outside world.

Simon.
0
 
LVL 37

Accepted Solution

by:
Jamie McKillop earned 1000 total points
ID: 38823146
Hello,

This powershell script will do what you want. Just set the $domain variable to the domain you want to remove.

$domain = ""
Get-Mailbox -ResultSize unlimited | % {
	foreach ($address in $_.emailaddresses) {
		If (($address.type -eq "SMTP") -and (($address.Address.Split("@")[1] -eq $domain))) {
			$_.emailaddresses -= [Microsoft.Exchange.Data.ProxyAddress]("smtp:$($address.address)")
		}
	}
	Set-Mailbox $_.primarysmtpaddress -EmailAddresses $_.EmailAddresses
}

Open in new window


JJ
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 38823226
wow that's cool jjmck, so where can I put the -WhatIf to check the script before I run it in production ?
0
 
LVL 37

Assisted Solution

by:Jamie McKillop
Jamie McKillop earned 1000 total points
ID: 38823240
Put the -whatif at the end of the set-mailbox command.

JJ
0
 
LVL 8

Author Closing Comment

by:Senior IT System Engineer
ID: 38823358
Thanks to all
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 38823364
is there any way to modify the script to display which mailbox got the secondary address ?

jjmck, many thanks in advance for the powershell assistance
0
 
LVL 37

Expert Comment

by:Jamie McKillop
ID: 38826660
This will output the display name of the mailbox anytime it finds a mailbox with an SMTP address that contains the domain you specify:

$domain = ""
Get-Mailbox -ResultSize unlimited | % {
	foreach ($address in $_.emailaddresses) {
		If (($address.type -eq "SMTP") -and (($address.Address.Split("@")[1] -eq $domain))) {
			$_.emailaddresses -= [Microsoft.Exchange.Data.ProxyAddress]("smtp:$($address.address)")
			$_.displayname
		}
	}
	Set-Mailbox $_.primarysmtpaddress -EmailAddresses $ProxyAddresses
}

Open in new window


JJ
0

Featured Post

Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question