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
how to change the primary smtp using login id?
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
}
ForEach($User in $Users)
{
write-host "Processing $($User.loginid)"
set-mailbox -identity $user.loginid -PrimarySmtpAddress $user.primaryemail -EmailAddressPolicyEnabled $false
}
Regards,
Sankar M
No comments:
Post a Comment