?
Solved

Delete secondary smtp address

Posted on 2014-08-20
4
Medium Priority
?
4,711 Views
Last Modified: 2014-08-21
Hello All,

I need some help to delete a secondary smtp address from users in a specific Exchange database. An email policy was incorrectly applied to this database, which added the secondary address by mistake.

I don't really have any skills with Powershell, so any help would be appreciated.
Thanks.
0
Comment
Question by:Ampletrix
  • 2
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 40275372
If your secondary email address is in format of <mailbox alias>@corp.contoso.com the you can try the following code..
$Mailboxes = Get-Mailbox -Database DB01 -result unlimited
Foreach ($Mailbox in $Mailboxes) {
$Smtp = "$($Mailbox.alias)@corp.contoso.com"
Set-Mailbox $Mailbox.alias -EmailAddresses @{remove=$Smtp}
}

Open in new window


An alternate method can be found from following article..
https://www.exchangecore.com/blog/powershell-removing-secondary-smtp-addresses-specified-domain/
0
 

Author Comment

by:Ampletrix
ID: 40275467
Thank you Subsun.

That worked great. Fantastic.
I've noticed something else though.
We have two custom attributes for two segregated databases and organizations.
Some of the new mailboxes don't have the custom attributes applied to them, and this may be part of the issues I'm getting.
Would it be possible to apply the attributes to any newly created mailboxes?

More details:
We have three segregated departments: (examples)
fabrikam.com (Custom Attribute1: Fabrikam)
Contoso.com (Custom Attribute2: Contoso)
Voorpullers.com (Custom Attribute3: Voorpullers)

I suspect that, when a new mailbox gets created (via a powershell script), it is created in the fabrikam database, because over 80% of time it is for Fabrikam. It is then moved to the other databases if required, but the custom attributes aren't applied automatically.
Is this something that can be done, and if possible, on s regular schedule?

Thanks for the help.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40275497
It is possible to update the attributes based on the database.. you need to schedule a script to check this and update it.. Since this is an additional request, please open a new question so we can work on it..
0
 

Author Closing Comment

by:Ampletrix
ID: 40278117
This was exactly what I was looking for. Thank you.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Here in this article, you will get a step by step guidance on how to restore an Exchange database to a recovery database. Get a brief on Recovery Database and how it can be used to restore Exchange database in this section!
Eseutil Hard Recovery is part of exchange tool and ensures Exchange mailbox data recovery when mailbox gets corrupt due to some problem on Exchange server.
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…
Screencast - Getting to Know the Pipeline
Suggested Courses

807 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