Solved

Add secondary SMTP Address with Powershell

Posted on 2010-09-23
2
6,590 Views
1 Endorsement
Last Modified: 2012-06-21
 I have Exchange 2007 with 1000 mailboxes defined. Each mail box has a Primary SMTP address added by an Address Police. I have about 200 Mailboxes that I need to add a secondary SMTP address. I would like to do this with powershell. When I try to add them with the Set-Mailbox command I get the following error.

Set-Mailbox : The e-mail addresses for this recipient are automatically generat
ed based on e-mail address policies. To modify the primary SMTP address for thi
s recipient, you must disable automatic updating of e-mail addresses based on e
-mail address policy.

  Ok So I disable the address policy with;
Set-Mailbox  -EmailAddressPolicyEnabled $False
And rerun the Set-Mailbox -emailaddresses user1@test.com and I get the following error;
Set-Mailbox : There is no primary SMTP address.

  All I want to do is add another Secondary SMTP address with PowerShell, without disturbing the address that are already there.  I can do this all day long with the Exchange Management Console!
1
Comment
Question by:gogetsome
[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
2 Comments
 
LVL 32

Accepted Solution

by:
endital1097 earned 500 total points
ID: 33746171
$user = get-malbox <user>
$user.emailaddresses += "smtp:second@domain.com"
set-mailbox $user -emailaddresses $user.emailaddresses
0
 

Author Closing Comment

by:gogetsome
ID: 33746740
Thanks,
That works great! That is what I thought that you were going to tell me. The list must be rebuilt each time.  I would have never come up with code that clean to rebuild the list on my own. I still do not have a good handle on storing an entire object in a variable. I guess I am still to old school!
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  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

How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

624 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