Exchange powershell command to add and make primary smtp address

Posted on 2016-08-17
Last Modified: 2016-09-06
i have the below command but once pasted its a no go

description : Add smtp and make primary keeping existent proxy addresses


#CSV = alias,addnewemailaddress

import-csv .\AddSmtpMakePrimaryProxy.csv | foreach {
$user = Get-Mailbox $_.alias
$user.emailAddresses+= $_.addnewemailaddress
$user.primarysmtpaddress = $_.addnewemailaddress
Set-Mailbox $user -emailAddresses $user.emailAddresses
set-Mailbox $user -PrimarySmtpAddress $user.primarysmtpaddress
Question by:Jorge Ocampo
  • 2
  • 2
LVL 38

Expert Comment

by:Adam Brown
ID: 41760243
You have to disable email address policy application to be able to change the Primary SMTP address if it is different from the existing policy. If you need to make the Primary SMTP address to change on all users, don't script the change, modify the Address Policy to make the new address format the primary one.

Author Comment

by:Jorge Ocampo
ID: 41760259
i am only doing for a select few
LVL 38

Accepted Solution

Adam Brown earned 500 total points
ID: 41760274
In that case, add
set-mailbox $user -EmailAddressPolicyEnabled $false

Open in new window

to your script before your first set-mailbox.

Author Closing Comment

by:Jorge Ocampo
ID: 41786470
not the full answer

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
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…
how to add IIS SMTP to handle application/Scanner relays into office 365.

757 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

21 Experts available now in Live!

Get 1:1 Help Now