PoshCode Archive  Artifact Content

Artifact c14836bed356b11865ae63d9f51c7b56a1a65341d0f5b034916ae5eedbd0dd0e:

  • File julio-fernandez-inai-org.ps1 — part of check-in [662673ad7d] at 2018-06-10 14:02:50 on branch trunk — Add new smtp address from csv and set new address primary (user: Ermias size: 612)

# encoding: ascii
# api: powershell
# title: julio.fernandez@inai.org
# description: Add new smtp address from csv and set new address primary
# version: 0.1
# author: Ermias
# license: CC0
# x-poshcode-id: 5859
# x-archived: 2015-05-16T04:47:51
# x-published: 2015-05-14T23:24: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
}