1 2 3 4 5 6 7 8 9 10 |
$users = Import-Csv file.csv foreach ($user in $users) { $oldsmtp="$($user.PrimarySmtpAddress)" $smtp = $user.PrimarySmtpAddress.Split('@')[0] $ext = $user.ExternalemailAddress.split('@')[0] $newsmtp = $smtp + "@newsmtp.domain.com" $newext = $ext + "@newext.fdomain.com" Set-Mailcontact $user.DistinguishedName -PrimarySMTPAddress $newsmtp -externalemailaddress $newext $oldsmtp Set-Mailcontact $user.DistinguishedName -EmailAddresses @{remove=”$oldsmtp”} |
}