PoshCode Archive  Artifact Content

Artifact 66afe4a1c3c7606ca565dae7c1b798d9ecd3ee03308f62af7794979e272470d5:

  • File teste-com-br.ps1 — part of check-in [c1d78aa81f] at 2018-06-10 14:06:42 on branch trunk — Add new smtp address from csv and set new address primary (user: Ermias size: 601)

# encoding: ascii
# api: powershell
# title: @teste.com.br
# description: Add new smtp address from csv and set new address primary
# version: 0.1
# author: Ermias
# license: CC0
# x-poshcode-id: 6038
# x-archived: 2016-05-17T16:57:09
# x-published: 2016-10-05T14:19: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
}