How to remove the SMTP address for a secondary domain from all Exchange mailboxes?Exchange 2003 SP2/2007: Address space ignored in SMTP ConnectorHow can I add subdomains of default accepted domain of Exchange 2010exchange 2007 with two accepted domains, send mailEmails sent from Coldfusion using the same SMTP/Exchange server works from one machine but fails for anotherHide server ip from email headerScript to remove Exchange 2010 AutoMapping for all mailboxesSMTP routing with EDGE servers for Exchange 2010Exchange 2010: Send emails via STMP with custom From address to outside the domainExchange 2003 SMTP does not receive RCPT from senderHow can I route messages from Intermedia Exchange to Office 365 if they share the same domain?
Why don't countries like Japan just print more money?
Minimum distance between holes in inner tube
How much will studying magic in an academy cost?
How would modern naval warfare have to have developed differently for battleships to still be relevant in the 21st century?
Suggested order for Amazon Prime Doctor Who series
How do I professionally let my manager know I'll quit over smoking in the office?
Can you find x?
How to get cool night-vision without lame drawbacks?
Unusual mail headers, evidence of an attempted attack. Have I been pwned?
Why do textbooks often include the solutions to odd or even numbered problems but not both?
Old sci-fi story: radiation mutated the animals, a boy loses a limb, but it's okay because "humans used to do great with only two arms"
When to remove insignificant variables?
Do I have any obligations to my PhD supervisor's requests after I have graduated?
Do I have to explain the mechanical superiority of the player-character within the fiction of the game?
How to colour a table with opaque colour such that no text and no lines are visible?
Employer wants to use my work email account after I quit
What did River say when she woke from her proto-comatose state?
Helping ease my back pain when I'm studying 13 hours everyday, even weekends
Who are the remaining King/Queenslayers?
How is hair tissue mineral analysis performed?
Inaccessible base class despite friendship
Is a single radon-daughter atom in air a solid?
Hot coffee brewing solutions for deep woods camping
Why use cross notes in sheet music for hip hop tracks?
How to remove the SMTP address for a secondary domain from all Exchange mailboxes?
Exchange 2003 SP2/2007: Address space ignored in SMTP ConnectorHow can I add subdomains of default accepted domain of Exchange 2010exchange 2007 with two accepted domains, send mailEmails sent from Coldfusion using the same SMTP/Exchange server works from one machine but fails for anotherHide server ip from email headerScript to remove Exchange 2010 AutoMapping for all mailboxesSMTP routing with EDGE servers for Exchange 2010Exchange 2010: Send emails via STMP with custom From address to outside the domainExchange 2003 SMTP does not receive RCPT from senderHow can I route messages from Intermedia Exchange to Office 365 if they share the same domain?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have an Exchange server which used to manage multiple SMTP domains; now it only has to manage one.
I have already removed the secondary domain from all address policies; I need to remove all SMTP addresses referencing it.
All users have their primary SMTP address set to use the primary domain; but almost all of them have another address using the secondary domain. They also have many other different addesses: the SIP one used for lync, and one or more X500 ones derived from previous migrations. These should not be touched at all.
How can I remove all those secondary SMTP addresses without affecting anything else?
exchange exchange-2010 smtp powershell
add a comment |
I have an Exchange server which used to manage multiple SMTP domains; now it only has to manage one.
I have already removed the secondary domain from all address policies; I need to remove all SMTP addresses referencing it.
All users have their primary SMTP address set to use the primary domain; but almost all of them have another address using the secondary domain. They also have many other different addesses: the SIP one used for lync, and one or more X500 ones derived from previous migrations. These should not be touched at all.
How can I remove all those secondary SMTP addresses without affecting anything else?
exchange exchange-2010 smtp powershell
2
ADModify.NET - admodify.codeplex.com
– joeqwerty
Dec 9 '13 at 17:54
+1 for ADModify.NET. It will do this easily...and can even make sure the "primary SMTP address/reply to" is set if necessary.
– TheCleaner
Dec 9 '13 at 19:17
add a comment |
I have an Exchange server which used to manage multiple SMTP domains; now it only has to manage one.
I have already removed the secondary domain from all address policies; I need to remove all SMTP addresses referencing it.
All users have their primary SMTP address set to use the primary domain; but almost all of them have another address using the secondary domain. They also have many other different addesses: the SIP one used for lync, and one or more X500 ones derived from previous migrations. These should not be touched at all.
How can I remove all those secondary SMTP addresses without affecting anything else?
exchange exchange-2010 smtp powershell
I have an Exchange server which used to manage multiple SMTP domains; now it only has to manage one.
I have already removed the secondary domain from all address policies; I need to remove all SMTP addresses referencing it.
All users have their primary SMTP address set to use the primary domain; but almost all of them have another address using the secondary domain. They also have many other different addesses: the SIP one used for lync, and one or more X500 ones derived from previous migrations. These should not be touched at all.
How can I remove all those secondary SMTP addresses without affecting anything else?
exchange exchange-2010 smtp powershell
exchange exchange-2010 smtp powershell
asked Dec 9 '13 at 17:38
MassimoMassimo
53.6k45172288
53.6k45172288
2
ADModify.NET - admodify.codeplex.com
– joeqwerty
Dec 9 '13 at 17:54
+1 for ADModify.NET. It will do this easily...and can even make sure the "primary SMTP address/reply to" is set if necessary.
– TheCleaner
Dec 9 '13 at 19:17
add a comment |
2
ADModify.NET - admodify.codeplex.com
– joeqwerty
Dec 9 '13 at 17:54
+1 for ADModify.NET. It will do this easily...and can even make sure the "primary SMTP address/reply to" is set if necessary.
– TheCleaner
Dec 9 '13 at 19:17
2
2
ADModify.NET - admodify.codeplex.com
– joeqwerty
Dec 9 '13 at 17:54
ADModify.NET - admodify.codeplex.com
– joeqwerty
Dec 9 '13 at 17:54
+1 for ADModify.NET. It will do this easily...and can even make sure the "primary SMTP address/reply to" is set if necessary.
– TheCleaner
Dec 9 '13 at 19:17
+1 for ADModify.NET. It will do this easily...and can even make sure the "primary SMTP address/reply to" is set if necessary.
– TheCleaner
Dec 9 '13 at 19:17
add a comment |
2 Answers
2
active
oldest
votes
Test this in a lab and/or on a small set of test users before hitting production with this please.
$SMTPDomainToRemove = "@OldDomain.com"
$AllUsers = Get-ADUser -Filter * -Properties proxyAddresses
Foreach($usr In $AllUsers)
$NewAddressList = @()
$OldAddressList = $usr.proxyAddresses
Foreach($addr In $OldAddressList)
If(!($addr -Match $SMTPDomainToRemove))
$NewAddressList += $addr
If($NewAddressList.Count -GT 0)
Set-ADUser $usr -Replace @ 'proxyAddresses' = $NewAddressList
The idea is that we're taking the proxyAddresses address list of each user, stripping out the ones that have the old domain name in them, and then replacing the address list with the new, updated one that does not contain references to the old domain name.
http://blogs.technet.com/b/exchange/archive/2005/01/10/350132.aspx
E-Mail Address Attributes
Exchange stores and uses information about the e-mail addresses of a
recipient in the following attributes: proxyAddresses
This is the main attribute where e-mail address information is kept.
When you open the properties of a recipient in Outlook and look at the
"E-mail Addresses" tab, you are looking at this attribute. This is a
multi-valued string containing all the addresses that represent the
recipient. Each value must have the following format: type:address
For example: SMTP:nospam@online.microsoft.com
When the type is in uppercase letters, the address is considered to be
the primary address of that type and it is used as the default reply
address of that recipient. When the type is in lowercase letters, the
address is considered a secondary address and is used to resolve
addresses during e-mail delivery, allowing the same recipient to
receive e-mails directed to different e-mail addresses.
1
Well, my primary address isolddomain.com@newdomain.com
and now I don't have to mind my inbox anymore, thanks! :D
– Mathias R. Jessen
Dec 9 '13 at 21:15
OK... How about$addr.ToLower().Trim().EndsWith($SMTPDomainToRemove.ToLower().Trim())
... better? :)
– Ryan Ries
Dec 9 '13 at 21:21
1
Or even just a well-placed @ sign... ;)
– Ryan Ries
Dec 9 '13 at 21:31
add a comment |
Found it!
$domain = 'olddomain.com'
$mbxs = (Get-Mailbox -ResultSize Unlimited | where $_.EmailAddresses -like ('*@' + $domain) )
foreach ($mbx in $mbxs)
$addresses = $mbx.EmailAddresses
$address = ($addresses
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f560175%2fhow-to-remove-the-smtp-address-for-a-secondary-domain-from-all-exchange-mailboxe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Test this in a lab and/or on a small set of test users before hitting production with this please.
$SMTPDomainToRemove = "@OldDomain.com"
$AllUsers = Get-ADUser -Filter * -Properties proxyAddresses
Foreach($usr In $AllUsers)
$NewAddressList = @()
$OldAddressList = $usr.proxyAddresses
Foreach($addr In $OldAddressList)
If(!($addr -Match $SMTPDomainToRemove))
$NewAddressList += $addr
If($NewAddressList.Count -GT 0)
Set-ADUser $usr -Replace @ 'proxyAddresses' = $NewAddressList
The idea is that we're taking the proxyAddresses address list of each user, stripping out the ones that have the old domain name in them, and then replacing the address list with the new, updated one that does not contain references to the old domain name.
http://blogs.technet.com/b/exchange/archive/2005/01/10/350132.aspx
E-Mail Address Attributes
Exchange stores and uses information about the e-mail addresses of a
recipient in the following attributes: proxyAddresses
This is the main attribute where e-mail address information is kept.
When you open the properties of a recipient in Outlook and look at the
"E-mail Addresses" tab, you are looking at this attribute. This is a
multi-valued string containing all the addresses that represent the
recipient. Each value must have the following format: type:address
For example: SMTP:nospam@online.microsoft.com
When the type is in uppercase letters, the address is considered to be
the primary address of that type and it is used as the default reply
address of that recipient. When the type is in lowercase letters, the
address is considered a secondary address and is used to resolve
addresses during e-mail delivery, allowing the same recipient to
receive e-mails directed to different e-mail addresses.
1
Well, my primary address isolddomain.com@newdomain.com
and now I don't have to mind my inbox anymore, thanks! :D
– Mathias R. Jessen
Dec 9 '13 at 21:15
OK... How about$addr.ToLower().Trim().EndsWith($SMTPDomainToRemove.ToLower().Trim())
... better? :)
– Ryan Ries
Dec 9 '13 at 21:21
1
Or even just a well-placed @ sign... ;)
– Ryan Ries
Dec 9 '13 at 21:31
add a comment |
Test this in a lab and/or on a small set of test users before hitting production with this please.
$SMTPDomainToRemove = "@OldDomain.com"
$AllUsers = Get-ADUser -Filter * -Properties proxyAddresses
Foreach($usr In $AllUsers)
$NewAddressList = @()
$OldAddressList = $usr.proxyAddresses
Foreach($addr In $OldAddressList)
If(!($addr -Match $SMTPDomainToRemove))
$NewAddressList += $addr
If($NewAddressList.Count -GT 0)
Set-ADUser $usr -Replace @ 'proxyAddresses' = $NewAddressList
The idea is that we're taking the proxyAddresses address list of each user, stripping out the ones that have the old domain name in them, and then replacing the address list with the new, updated one that does not contain references to the old domain name.
http://blogs.technet.com/b/exchange/archive/2005/01/10/350132.aspx
E-Mail Address Attributes
Exchange stores and uses information about the e-mail addresses of a
recipient in the following attributes: proxyAddresses
This is the main attribute where e-mail address information is kept.
When you open the properties of a recipient in Outlook and look at the
"E-mail Addresses" tab, you are looking at this attribute. This is a
multi-valued string containing all the addresses that represent the
recipient. Each value must have the following format: type:address
For example: SMTP:nospam@online.microsoft.com
When the type is in uppercase letters, the address is considered to be
the primary address of that type and it is used as the default reply
address of that recipient. When the type is in lowercase letters, the
address is considered a secondary address and is used to resolve
addresses during e-mail delivery, allowing the same recipient to
receive e-mails directed to different e-mail addresses.
1
Well, my primary address isolddomain.com@newdomain.com
and now I don't have to mind my inbox anymore, thanks! :D
– Mathias R. Jessen
Dec 9 '13 at 21:15
OK... How about$addr.ToLower().Trim().EndsWith($SMTPDomainToRemove.ToLower().Trim())
... better? :)
– Ryan Ries
Dec 9 '13 at 21:21
1
Or even just a well-placed @ sign... ;)
– Ryan Ries
Dec 9 '13 at 21:31
add a comment |
Test this in a lab and/or on a small set of test users before hitting production with this please.
$SMTPDomainToRemove = "@OldDomain.com"
$AllUsers = Get-ADUser -Filter * -Properties proxyAddresses
Foreach($usr In $AllUsers)
$NewAddressList = @()
$OldAddressList = $usr.proxyAddresses
Foreach($addr In $OldAddressList)
If(!($addr -Match $SMTPDomainToRemove))
$NewAddressList += $addr
If($NewAddressList.Count -GT 0)
Set-ADUser $usr -Replace @ 'proxyAddresses' = $NewAddressList
The idea is that we're taking the proxyAddresses address list of each user, stripping out the ones that have the old domain name in them, and then replacing the address list with the new, updated one that does not contain references to the old domain name.
http://blogs.technet.com/b/exchange/archive/2005/01/10/350132.aspx
E-Mail Address Attributes
Exchange stores and uses information about the e-mail addresses of a
recipient in the following attributes: proxyAddresses
This is the main attribute where e-mail address information is kept.
When you open the properties of a recipient in Outlook and look at the
"E-mail Addresses" tab, you are looking at this attribute. This is a
multi-valued string containing all the addresses that represent the
recipient. Each value must have the following format: type:address
For example: SMTP:nospam@online.microsoft.com
When the type is in uppercase letters, the address is considered to be
the primary address of that type and it is used as the default reply
address of that recipient. When the type is in lowercase letters, the
address is considered a secondary address and is used to resolve
addresses during e-mail delivery, allowing the same recipient to
receive e-mails directed to different e-mail addresses.
Test this in a lab and/or on a small set of test users before hitting production with this please.
$SMTPDomainToRemove = "@OldDomain.com"
$AllUsers = Get-ADUser -Filter * -Properties proxyAddresses
Foreach($usr In $AllUsers)
$NewAddressList = @()
$OldAddressList = $usr.proxyAddresses
Foreach($addr In $OldAddressList)
If(!($addr -Match $SMTPDomainToRemove))
$NewAddressList += $addr
If($NewAddressList.Count -GT 0)
Set-ADUser $usr -Replace @ 'proxyAddresses' = $NewAddressList
The idea is that we're taking the proxyAddresses address list of each user, stripping out the ones that have the old domain name in them, and then replacing the address list with the new, updated one that does not contain references to the old domain name.
http://blogs.technet.com/b/exchange/archive/2005/01/10/350132.aspx
E-Mail Address Attributes
Exchange stores and uses information about the e-mail addresses of a
recipient in the following attributes: proxyAddresses
This is the main attribute where e-mail address information is kept.
When you open the properties of a recipient in Outlook and look at the
"E-mail Addresses" tab, you are looking at this attribute. This is a
multi-valued string containing all the addresses that represent the
recipient. Each value must have the following format: type:address
For example: SMTP:nospam@online.microsoft.com
When the type is in uppercase letters, the address is considered to be
the primary address of that type and it is used as the default reply
address of that recipient. When the type is in lowercase letters, the
address is considered a secondary address and is used to resolve
addresses during e-mail delivery, allowing the same recipient to
receive e-mails directed to different e-mail addresses.
edited Dec 9 '13 at 21:30
answered Dec 9 '13 at 18:10
Ryan RiesRyan Ries
50.9k8118181
50.9k8118181
1
Well, my primary address isolddomain.com@newdomain.com
and now I don't have to mind my inbox anymore, thanks! :D
– Mathias R. Jessen
Dec 9 '13 at 21:15
OK... How about$addr.ToLower().Trim().EndsWith($SMTPDomainToRemove.ToLower().Trim())
... better? :)
– Ryan Ries
Dec 9 '13 at 21:21
1
Or even just a well-placed @ sign... ;)
– Ryan Ries
Dec 9 '13 at 21:31
add a comment |
1
Well, my primary address isolddomain.com@newdomain.com
and now I don't have to mind my inbox anymore, thanks! :D
– Mathias R. Jessen
Dec 9 '13 at 21:15
OK... How about$addr.ToLower().Trim().EndsWith($SMTPDomainToRemove.ToLower().Trim())
... better? :)
– Ryan Ries
Dec 9 '13 at 21:21
1
Or even just a well-placed @ sign... ;)
– Ryan Ries
Dec 9 '13 at 21:31
1
1
Well, my primary address is
olddomain.com@newdomain.com
and now I don't have to mind my inbox anymore, thanks! :D– Mathias R. Jessen
Dec 9 '13 at 21:15
Well, my primary address is
olddomain.com@newdomain.com
and now I don't have to mind my inbox anymore, thanks! :D– Mathias R. Jessen
Dec 9 '13 at 21:15
OK... How about
$addr.ToLower().Trim().EndsWith($SMTPDomainToRemove.ToLower().Trim())
... better? :)– Ryan Ries
Dec 9 '13 at 21:21
OK... How about
$addr.ToLower().Trim().EndsWith($SMTPDomainToRemove.ToLower().Trim())
... better? :)– Ryan Ries
Dec 9 '13 at 21:21
1
1
Or even just a well-placed @ sign... ;)
– Ryan Ries
Dec 9 '13 at 21:31
Or even just a well-placed @ sign... ;)
– Ryan Ries
Dec 9 '13 at 21:31
add a comment |
Found it!
$domain = 'olddomain.com'
$mbxs = (Get-Mailbox -ResultSize Unlimited | where $_.EmailAddresses -like ('*@' + $domain) )
foreach ($mbx in $mbxs)
$addresses = $mbx.EmailAddresses
$address = ($addresses
add a comment |
Found it!
$domain = 'olddomain.com'
$mbxs = (Get-Mailbox -ResultSize Unlimited | where $_.EmailAddresses -like ('*@' + $domain) )
foreach ($mbx in $mbxs)
$addresses = $mbx.EmailAddresses
$address = ($addresses
add a comment |
Found it!
$domain = 'olddomain.com'
$mbxs = (Get-Mailbox -ResultSize Unlimited | where $_.EmailAddresses -like ('*@' + $domain) )
foreach ($mbx in $mbxs)
$addresses = $mbx.EmailAddresses
$address = ($addresses
Found it!
$domain = 'olddomain.com'
$mbxs = (Get-Mailbox -ResultSize Unlimited | where $_.EmailAddresses -like ('*@' + $domain) )
foreach ($mbx in $mbxs)
$addresses = $mbx.EmailAddresses
$address = ($addresses
edited Jun 5 at 19:15
answered Dec 9 '13 at 18:27
MassimoMassimo
53.6k45172288
53.6k45172288
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f560175%2fhow-to-remove-the-smtp-address-for-a-secondary-domain-from-all-exchange-mailboxe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
ADModify.NET - admodify.codeplex.com
– joeqwerty
Dec 9 '13 at 17:54
+1 for ADModify.NET. It will do this easily...and can even make sure the "primary SMTP address/reply to" is set if necessary.
– TheCleaner
Dec 9 '13 at 19:17