PoshCode Archive  Artifact [42b45dfd69]

Artifact 42b45dfd69b8b3349dc6b8d7b7806149b597c6e9b6d56b81444a02a8a6c8b90d:

  • File Add-new-smtp-set-prmary.ps1 — part of check-in [13d3c56436] at 2018-06-10 13:46:41 on branch trunk — ethicshotline@navarre.com,ethicshotline@speedcommerce.com (user: Ermias size: 611)

# encoding: ascii
# api: powershell
# title: Add new smtp/set prmary
# description: ethicshotline@navarre.com,ethicshotline@speedcommerce.com
# version: 0.1
# author: Ermias
# license: CC0
# x-poshcode-id: 4846
# x-archived: 2014-04-10T15:34:01
# x-published: 2014-01-27T19:51:00
#
#
#alias,addnewemailaddress

import-csv .\source.csv | foreach {
$user = Get-Mailbox $_.alias
$user.emailAddresses+= $_.addnewemailaddress
$user.primarysmtpaddress = $_.addnewemailaddress
Set-Mailbox $user -emailAddresses $user.emailAddresses
set-Mailbox $user -PrimarySmtpAddress $user.primarysmtpaddress
}