• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3092
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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