If you are syncing from on-prem to Exchange Online, change on-prem powershell:
https://learn.microsoft.com/en-us/powershell/module/exchange/set-mailbox?view=exchange-ps
set-mailbox <user> -PrimarySMTPAddress user@contoso.com
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I wanted to change the email address of a user in exchange server by powershell command which also needs to be updated on active directory
If you are syncing from on-prem to Exchange Online, change on-prem powershell:
https://learn.microsoft.com/en-us/powershell/module/exchange/set-mailbox?view=exchange-ps
set-mailbox <user> -PrimarySMTPAddress user@contoso.com
Hi @ Athique Nihal , Just wondering if there is another proxy address for this mailbox. If not ,you can refer to the following command to change directly:
Set-Mailbox user2 -EmailAddressPolicyEnabled $False
Set-Mailbox user2 -EmailAddresses $list
If the mailbox has other proxy addresses and needs to be retained, you cloud refer to the following script to modify the primary email address:
Set-Mailbox user2 -EmailAddressPolicyEnabled $False
$mb = Get-Mailbox user2
$newPrimaryMail = "user3@domain.com"
$list = New-Object System.Collections.ArrayList
foreach($address in $mb.EmailAddresses) {
if ($address.IsPrimaryAddress -eq "true") {
$address = "SMTP:" + $newPrimaryMail
}
else {
$address = $address.ProxyAddressString
}
$list.Add($address)
}
Set-Mailbox user2 -EmailAddresses $list
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.