How to remove an email alias/address from office 365 user when user no longer has exchange online license
We want to transfer our domain to another Tenant. in the old Tenant there are no subscriptions so i can no longer edit the users email aliases ( it states "this user doesn't have an Exchange online license ) and as such cannot remove our public domain from office 365
I have tried the following script: (THIS ARTICLE)
$Records = Get-mailbox -ResultSize Unlimited| where {$.emailaddresses -like "smtp:*@domain.com"} | Select-Object DisplayName,@{Name=“EmailAddresses”;Expression={$.EmailAddresses |Where-Object {$_ -like “smtp:*domain.com”}}} foreach ($record in $Records) { write-host "Removing Alias" $record.EmailAddresses "for" $record.DisplayName Set-Mailbox $record.DisplayName -EmailAddresses @{Remove=$record.EmailAddresses} }
but it does not do anything. in powershell it says:
Set-Mailbox: Ex6F9304|Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException|The operation could not be performed
because the object '' was not found on '**.PROD.OUTLOOK.COM'.