Solved

Add secondary SMTP Address with Powershell

Posted on 2010-09-23
2
5,335 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Easy CSR creation in Exchange 2007,2010 and 2013
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this video we show how to create a mailbox database 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 Servers >> Data…
This video discusses moving either the default database or any database to a new volume.

758 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now