• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2553
  • Last Modified:

Exchange powershell command to add and make primary smtp address

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
}
0
Jorge Ocampo
Asked:
Jorge Ocampo
  • 2
  • 2
1 Solution
 
Adam BrownSr Solutions ArchitectCommented:
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.
0
 
Jorge OcampoAuthor Commented:
i am only doing for a select few
0
 
Adam BrownSr Solutions ArchitectCommented:
In that case, add
set-mailbox $user -EmailAddressPolicyEnabled $false

Open in new window

to your script before your first set-mailbox.
0
 
Jorge OcampoAuthor Commented:
not the full answer
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now