# encoding: ascii
# api: powershell
# title: Add new smtp/set prmary
# description: anand@xx.com
# version: 0.1
# author: Ermias
# license: CC0
# x-poshcode-id: 2864
# x-archived: 2016-05-16T08:33:05
# x-published: 2012-07-28T00:45: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
}
