Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add secondary SMTP Address with Powershell

Posted on 2010-09-23
2
Medium Priority
?
7,026 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 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
In this video we show how to create a Shared Mailbox 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 Recipients >> Sha…
This video discusses moving either the default database or any database to a new volume.

705 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