Link to home
Start Free TrialLog in
Avatar of Ben S
Ben S

asked on

Office 365 Proxy Address

Hi,

I am trying to remove an old email address from a user in AD thats sync via AAD Connect as I would like to use the email address for a DL.

In AD I have removed the SMTP address from proxyAddresses and forced a sync but the email address is still listed in the Office portal, how can I remove the address?

UPN - reception@companya.com
email to remove from user - reception@companya.com
Current primary email - jo@companyb.com

Thanks,
Avatar of J0rtIT
J0rtIT
Flag of Venezuela, Bolivarian Republic of image

Hi ben, you would need just to remove it completely, force update and then create use it in your DL.

$credential = New-Object -TypeName System.Management.Automation.PSCredential -argumentList  "user@domain.onmicrosoft.com", ("thePassword" | ConvertTo-securestring -AsPlainText -Force)
Connect-MsolService -Credential $Credential

#Remove users online users without license
Get-MsolUser | where{ $_.isLicensed -eq  $false} | foreach{ Remove-MsolUser -UserPrincipalName $_.UserPrincipalName}

Open in new window


jose
Avatar of Ben S
Ben S

ASKER

Hi Jose,

Would  jo@companyb.com lose the mail in the mailbox running the above PowerShell?

I have tried other script but keep getting this error:

The operation on mailbox "User" failed because it's out of the
current user's write scope. The action 'Set-Mailbox', 'EmailAddresses', can't
be performed on the object 'User' because the object is being
synchronized from your on-premises organization. This action should be
performed on the object in your on-premises organization.
In the 1st line, would be your domain admin user

in the second line would be the one you want to remove, this would be

#This would be the remove of the deteledusers
Get-MsolUser -ReturnDeletedUsers | foreach{ Remove-MsolUser -RemoveFromRecycleBin -ObjectId $_.Objectid -Force }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
1.  If you're syncing, it has to be removed from on-premises.
2. You're trying to remove the SMTP address that matches the UPN of the user, which will cause you problems.