PoshCode Logo PowerShell Code Repository

Add new smtp/set prmary (modification of post by Ermias view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1714"></script>download | new post

Add new smtp address from csv and set new address primary

  1. #alias,addnewemailaddress
  2.  
  3. import-csv .\source.csv | foreach {
  4. $user = Get-Mailbox $_.alias
  5. $user.emailAddresses+= $_.addnewemailaddress
  6. $user.primarysmtpaddress = $_.addnewemailaddress
  7. Set-Mailbox $user -emailAddresses $user.emailAddresses
  8. set-Mailbox $user -PrimarySmtpAddress $user.primarysmtpaddress
  9. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me