PoshCode Archive  Artifact [85f1b4eda7]

Artifact 85f1b4eda7827cf41f20fa3f89459d4700b35eda0e5d0dbd0977dd7fd23c3711:

  • File Add-new-smtp-set-prmary.ps1 — part of check-in [da57f66241] at 2018-06-10 13:55:55 on branch trunk — help-84 (user: Ermias size: 561)

# encoding: ascii
# api: powershell
# title: Add new smtp/set prmary
# description: help-84
# version: 0.1
# author: Ermias
# license: CC0
# x-poshcode-id: 5482
# x-archived: 2014-10-08T15:35:05
# x-published: 2014-10-02T18:14: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
}