Friday, 3 August 2012

How to set the pimary email address and making the existing one as secondary email address

Here is the script to set the primary email address and making the existing as the secondary. if we do so, if anyone sending a mail to old email address, we can avoid the NDR

Import-Csv d:\alias.csv | Foreach-object { Set-Mailbox $_.alias -emailaddresspolicyenabled $false -PrimarySmtpAddress $_.SmtpAddress }


how to change the primary smtp using login id?

$Users = Import-CSV c:\myfile.csv
ForEach($User in $Users)
{
write-host "Processing $($User.loginid)"
set-mailbox -identity $user.loginid -PrimarySmtpAddress $user.primaryemail -EmailAddressPolicyEnabled $false
}

Regards,
Sankar M