%3CLINGO-SUB%20id%3D%22lingo-sub-607619%22%20slang%3D%22en-US%22%3EPermanently%20Clear%20Previous%20Mailbox%20Info%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-607619%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20introducing%20a%20new%20parameter%20that%20can%20be%20called%20by%20using%20the%20Set-User%20cmdlet%20in%20Exchange%20Online%20PowerShell.%20The%20feature%20is%20focused%20for%20customers%20doing%20migration%20of%20on-premises%20mailboxes%20to%20the%20cloud%20and%20you%20will%20be%20able%20to%20use%20it%20within%20three%20weeks%20or%20so%20(Edit%201%2F19%3A%20we%20updated%20this%20due%20to%20slower%20than%20expected%20rollout)%3A%20Customers%20who%20have%20Hybrid%20or%3CA%3E%3C%2FA%3E%20on-premises%20environments%20with%20AAD%20Connect%20%2F%20Dir%20Sync%20may%20have%20faced%20the%20following%20scenario%3A%3COL%3E%0A%20%20%3CLI%3EUser%20Jon%40contoso.com%20has%20a%20mailbox%20on-premises.%20Jon%20is%20represented%20as%20a%20Mail%20User%20in%20the%20cloud.%3C%2FLI%3E%0A%20%20%3CLI%3EYou%20are%20synchronizing%20the%20on-premises%20directory%20to%20the%20cloud%20in%20preparation%20to%20migrate%20to%20Exchange%20Online.%3C%2FLI%3E%0A%20%20%3CLI%3EDue%20to%20issues%20with%20the%20on-premises%20sync%20or%20due%20to%20a%20configuration%20problem%2C%20the%20user%20Jon%40contoso.com%20does%20not%20get%20the%20ExchangeGUID%20synchronized%20from%20on-premises%20to%20the%20cloud.%3C%2FLI%3E%0A%20%20%3CLI%3EIf%20the%20Exchange%20GUID%20is%20missing%20from%20the%20object%20in%20the%20cloud%2C%20assigning%20an%20Exchange%20license%20to%20Jon%40contoso.com%20will%20cause%20Exchange%20Online%20to%20give%20the%20user%20a%20mailbox%2C%20converting%20the%20object%20from%20a%20Mail%20User%20to%20a%20User%20Mailbox.%20(Adding%20the%20license%20is%20a%20step%20required%20for%20the%20migration%20of%20the%20mailbox%20from%20on-premises%20to%20the%20cloud.)%3C%2FLI%3E%0A%20%20%3CLI%3EThe%20end%20result%20is%20the%20user%20that%20has%202%20mailboxes%3A%20one%20on-premises%20and%20one%20in%20the%20cloud.%20This%20is%20not%20good.%20Mail%20flow%20issues%20will%20follow.%3C%2FLI%3E%0A%3C%2FOL%3EThose%20doing%20these%20types%20of%20migrations%20will%20know%20that%20the%20ExchangeGUID%20value%20is%20very%20important%20as%20it%20helps%20Exchange%20Online%20identify%20that%20the%20user%20has%20a%20mailbox%20on-premises%2C%20and%20if%20an%20Exchange%20license%20is%20assigned%20in%20the%20cloud%2C%20a%20new%20mailbox%20should%20%3CI%3Enot%3C%2FI%3E%20be%20created.%20The%20immediate%20fix%20for%20this%20situation%20is%20to%20remove%20the%20Exchange%20License%20from%20Jon%40contoso.com.%20This%20will%20convert%20the%20cloud%20object%20for%20Jon%20back%20to%20a%20Mail%20User.%20Mail%20flow%20should%20be%20restored%20at%20this%20point.%20The%20problem%20now%20is%20that%20you%20have%20an%20%E2%80%9Cunclean%E2%80%9D%20cloud%20object%20for%20Jon.%20This%20is%20because%20Exchange%20online%20keeps%20pointers%20that%20indicate%20that%20there%20used%20to%20be%20a%20mailbox%20in%20the%20cloud%20for%20this%20user%3A%3C%2FP%3E%3CP%20class%3D%22code%22%3EPS%20C%3A%5CWINDOWS%5Csystem32%26gt%3B%20Get-User%20Jon%40contoso.com%20%7C%20Select%20name%2C*Recipient*%3CBR%20%2F%3EName%20%3CSPAN%20style%3D%22color%3A%20%23ff0000%22%3EPreviousRecipientTypeDetails%3C%2FSPAN%3E%20RecipientType%20RecipientTypeDetails%3CBR%20%2F%3E----%20----------------------------%20-------------%20--------------------%3CBR%20%2F%3EJon%20%3CSPAN%20style%3D%22color%3A%20%23ff0000%22%3EUserMailbox%3C%2FSPAN%3E%20MailUser%20MailUser%3C%2FP%3ERe-assigning%20the%20license%20after%20that%20will%20always%20err%20on%20the%20side%20of%20caution%20and%20Exchange%20Online%20will%20try%20to%20re-connect%20the%20(duplicate%2C%20temporary)%20mailbox%20in%20the%20cloud%20(and%20mailboxes%20can%20be%20reconnected%20for%2030%20days).%20Therefore%20Jon%E2%80%99s%20account%20in%20the%20cloud%20can%E2%80%99t%20be%20licensed%20in%20preparation%20for%20migration.%20Up%20to%20now%2C%20one%20of%20the%20few%20options%20to%20fix%20this%20problem%20was%20to%20delete%20*only%20in%20the%20cloud*%20Jon%E2%80%99s%20object%20and%20re-sync%20it%20from%20on-premises.%20This%20would%20delete%20jon%40contoso.com%20from%20the%20cloud%20%E2%80%93%20but%20from%20%3CB%3Eall%20workloads%3C%2FB%3E%2C%20not%20only%20Exchange.%20This%20is%20problematic%20because%20Jon%20could%20have%20his%20OneDrive%20or%20SharePoint%20data%20in%20the%20cloud%20only%20and%20deleting%20his%20account%20means%20that%20this%20will%20be%20deleted%20too.%20If%20the%20account%20is%20then%20re-created%2C%20Jon%20and%20the%20tenant%20admin%20would%20have%20to%20work%20to%20recover%20to%20his%20new%20account%20all%20the%20data%20he%20used%20to%20have%20in%20OneDrive%20or%20SharePoint%20just%20because%20Exchange%20data%20needed%20to%20be%20%E2%80%9Ccleaned%20up%E2%80%9D.%20The%20new%20parameter%20in%20the%20user%20cmdlet%20will%20allow%20tenant%20admin%20to%20clean%20up%20Exchange%20Online%20Jon%E2%80%99s%20object%20without%20having%20to%20delete%20it.%20To%20clean%20the%20object%2C%20you%20can%20run%20the%20following%20command%3A%3CP%20class%3D%22code%22%3EPS%20C%3A%5C%26gt%3B%20Set-User%20Jon%40contoso.com%20-%3CSPAN%20style%3D%22color%3A%20%23ff0000%22%3EPermanentlyClearPreviousMailboxInfo%3C%2FSPAN%3E%3CBR%20%2F%3EConfirm%3CBR%20%2F%3EAre%20you%20sure%20you%20want%20to%20perform%20this%20action%3F%3CBR%20%2F%3EDelete%20all%20existing%20information%20about%20user%20%E2%80%9CJon%40contoso.com%22%3F.%20This%20operation%20will%20clear%20existing%20values%20from%20Previous%20home%20MDB%20and%20Previous%20Mailbox%20GUID%20of%20the%20user.%20After%20deletion%2C%20reconnecting%20to%20the%20previous%20mailbox%20that%20existed%20in%20the%20cloud%20will%20not%20be%20possible%20and%20any%20content%20it%20had%20will%20be%20unrecoverable%20PERMANENTLY.%20Do%20you%20want%20to%20continue%3F%3CBR%20%2F%3E%3CY%3EYes%26nbsp%3B%20%3CA%3E%20Yes%20to%20All%26nbsp%3B%3CN%3ENo%26nbsp%3B%3CL%3ENo%20to%20All%26nbsp%3B%20%5B%3F%5D%20Help%20(default%20is%20%22Y%22)%3A%20Y%3C%2FL%3E%3C%2FN%3E%3C%2FA%3E%3C%2FY%3E%3C%2FP%3EExecuting%20this%20leaves%20you%20with%20a%20clean%20object%20that%20can%20be%20re-licensed%20without%20causing%20the%202-mailbox%20problem.%20Now%20you%20can%20on-board%20Jon%E2%80%99s%20on-premises%20mailbox%20following%20the%20usual%20steps.%20An%20alternative%20%E2%80%93%20a%20call%20to%20support%20to%20do%20the%20clean-up%20for%20you%20-%20is%20also%20not%20needed.%20%3CB%3E%3CI%3E%3CU%3ERemember%2C%20cleaning%20up%20the%20user%20means%20that%20the%20older%20associated%20disconnected%20(duplicate)%20cloud%20mailbox%20is%20not%20recoverable.%20If%20you%20want%20to%20keep%20it%20or%20be%20able%20to%20check%20it%E2%80%99s%20content%2C%20we%20recommend%20using%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fdn186233(v%3Dexchg.150).aspx%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ESoft%20Deletion%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2FOverview-of-inactive-mailboxes-in-Office-365-1fbd74e8-7a60-4157-afe8-fe79f05d2038%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EInactive%20Mailboxes%3C%2FA%3E%20to%20keep%20the%20mailbox.%3C%2FU%3E%3C%2FI%3E%3C%2FB%3E%20%3CSPAN%20class%3D%22author%22%3EMario%20Trigueros%20Solorio%3C%2FSPAN%3E%3C%2FLINGO-BODY%3E

We are introducing a new parameter that can be called by using the Set-User cmdlet in Exchange Online PowerShell. The feature is focused for customers doing migration of on-premises mailboxes to the cloud and you will be able to use it within three weeks or so (Edit 1/19: we updated this due to slower than expected rollout): Customers who have Hybrid or on-premises environments with AAD Connect / Dir Sync may have faced the following scenario:

  1. User Jon@contoso.com has a mailbox on-premises. Jon is represented as a Mail User in the cloud.
  2. You are synchronizing the on-premises directory to the cloud in preparation to migrate to Exchange Online.
  3. Due to issues with the on-premises sync or due to a configuration problem, the user Jon@contoso.com does not get the ExchangeGUID synchronized from on-premises to the cloud.
  4. If the Exchange GUID is missing from the object in the cloud, assigning an Exchange license to Jon@contoso.com will cause Exchange Online to give the user a mailbox, converting the object from a Mail User to a User Mailbox. (Adding the license is a step required for the migration of the mailbox from on-premises to the cloud.)
  5. The end result is the user that has 2 mailboxes: one on-premises and one in the cloud. This is not good. Mail flow issues will follow.
Those doing these types of migrations will know that the ExchangeGUID value is very important as it helps Exchange Online identify that the user has a mailbox on-premises, and if an Exchange license is assigned in the cloud, a new mailbox should not be created. The immediate fix for this situation is to remove the Exchange License from Jon@contoso.com. This will convert the cloud object for Jon back to a Mail User. Mail flow should be restored at this point. The problem now is that you have an “unclean” cloud object for Jon. This is because Exchange online keeps pointers that indicate that there used to be a mailbox in the cloud for this user:

PS C:\WINDOWS\system32> Get-User Jon@contoso.com | Select name,*Recipient*
Name PreviousRecipientTypeDetails RecipientType RecipientTypeDetails
---- ---------------------------- ------------- --------------------
Jon UserMailbox MailUser MailUser

Re-assigning the license after that will always err on the side of caution and Exchange Online will try to re-connect the (duplicate, temporary) mailbox in the cloud (and mailboxes can be reconnected for 30 days). Therefore Jon’s account in the cloud can’t be licensed in preparation for migration. Up to now, one of the few options to fix this problem was to delete *only in the cloud* Jon’s object and re-sync it from on-premises. This would delete jon@contoso.com from the cloud – but from all workloads, not only Exchange. This is problematic because Jon could have his OneDrive or SharePoint data in the cloud only and deleting his account means that this will be deleted too. If the account is then re-created, Jon and the tenant admin would have to work to recover to his new account all the data he used to have in OneDrive or SharePoint just because Exchange data needed to be “cleaned up”. The new parameter in the user cmdlet will allow tenant admin to clean up Exchange Online Jon’s object without having to delete it. To clean the object, you can run the following command:

PS C:\> Set-User Jon@contoso.com -PermanentlyClearPreviousMailboxInfo
Confirm
Are you sure you want to perform this action?
Delete all existing information about user “Jon@contoso.com"?. This operation will clear existing values from Previous home MDB and Previous Mailbox GUID of the user. After deletion, reconnecting to the previous mailbox that existed in the cloud will not be possible and any content it had will be unrecoverable PERMANENTLY. Do you want to continue?
Yes  Yes to All  No  No to All  [?] Help (default is "Y"): Y

Executing this leaves you with a clean object that can be re-licensed without causing the 2-mailbox problem. Now you can on-board Jon’s on-premises mailbox following the usual steps. An alternative – a call to support to do the clean-up for you - is also not needed. Remember, cleaning up the user means that the older associated disconnected (duplicate) cloud mailbox is not recoverable. If you want to keep it or be able to check it’s content, we recommend using Soft Deletion or Inactive Mailboxes to keep the mailbox. Mario Trigueros Solorio
18 Comments
Not applicable
I have been in this scenario where a directory sync misconfiguration allowed Exchange Online to provision mailboxes instead of mail users and I can confirm, it was pretty hard to recover from this situation. This new feature is definitely an improvement. Implementing the feature as a switch for Set-User does not feel very intuitive though, but I like the clear warning text that's presented before asking confirmation.
Not applicable
I could have used this in my last migration project! It would have made things a lot easier. Thanks for adding this new switch.
Not applicable
Welcome addition to the service. I run into this a fair amount with clients; this will save a ton of time/effort.
Not applicable
I'm currently in this scenario, but moreso because the guy before me, decided to create Exchange accounts in O365 prior to Azure AD Connect setup. I've had to script the clean up and yes, it's not good as you lose so much more than just the mailbox. This new command will be very useful, shame it's not out earlier, as I could have tested it, this week.

Thanks and nice work!

Not applicable
This is a welcome addition, but the mailbox that was provisioned prematurely might now have stuff in it. it would be great if there was a way to restore the content from the smaller mailbox and merge it with the larger, with minimal code. Also, I've found that many of the times mailboxes are provisioned prematurely are related to the wrong immudableID flowing in a linked mailbox scenario. In that case, we're still required to hard-delete the cloud user.

Honestly, a better fix would be to allow us to disconnect the SPO workloads from the aAD object. We have several tools with Exchange, but those guys don't seem to acknowledge the problem.

Occasional Visitor

I was hopeful that this was the answer to my problem, but I get "Command completed successfully, but no user settings were changed." Still can't sync due to "Target user already has a primary mailbox". Users have significant OneDrive and Sharepoint content, so account delete is not a great option. Any insight would be appreciated.

Frequent Visitor

@tguarriello we are in exactly the same boat and get the same "no user settings were changed". Did you or anyone else ever resolve this satisfactorily to be able to keep the previous OneDrive etc. account data? Any help would be much appreciated. Thanks

Occasional Visitor

@tguarriello @TOPIT : Did either of you find a solution to this?

 

I have tried many ways to remove the users Exchange license, but it doesn't actually seem to do anything. All the cmdlets claim the licence is still there, yet the Admin panel says it is gone. I am unable to use PermanentlyClearPreviousMailboxInfo or even Disable-Mailbox.

 

Is there a delay between removing the license and the decommissioning workflow? Or should it be fairly immediate?

 

The only way I seem to be able to resolve this is to completely remove the MSOL user. Does anyone have any current info on this? Thanks.

Occasional Visitor

@Brad_Reeve 

 

You need to remove the Exchange Online license, then in Exchange Online Powershell enter the cmdlet.

 

Set-User Jon@contoso.com -PermanentlyClearPreviousMailboxInfo

 

Reassign Exchange Online license

Visitor

@mmomyI have tried to remove Exchange Online licence, after that I ran the command:

 

Set-User Jon@contoso.com -PermanentlyClearPreviousMailboxInfo

But still getting "WARNING: The command completed successfully but no settings of 'Jon' have been modified"

 

Is there a delay between removing the license and the decommissioning workflow? Or should it be fairly immediate?

 

Because - After i re-assigned the Exchange Online licence, the mailbox is still not visible in EAC.

When I try to set-user xx@example.com -PermanentlyClearPreviousMailboxInfo there is an error:

 

A parameter cannot be found that matches parameter name 'PermanentlyClearPreviousMailboxInfo'.
+ CategoryInfo : InvalidArgument: (:) [Set-User], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Set-User
+ PSComputerName : outlook.office365.com

 

Just using set-user xx@example.com gives a warning that no setting has been changed. When I use get-user I can see the user has an UserMailbox in PreviousRecipientTypeDetails.

 

How can I get rid of this old mailbox. The User is still On-Premises and everytime I try to setup outlook the user gets connected to the empty online mailbox :sad:

 

Found a solution... set-user with  -PermanentlyClearPreviousMailboxInfo works when using the Exchange Online PowerShell V2 module.

Occasional Contributor

This procedure does nothing for me:

 

  1. Remove the user's license.
  2. Run Get-Mailbox <user> until it returns an error indicating the mailbox doesn't exist. This is my proxy for knowing that the back-end replication has completed.
  3. Run Set-User -PermanentlyClearPreviousMailboxInfo. This completes with no errors or warnings.
  4. Add the user's license.
  5. Run Get-Mailbox <user> until it returns the mailbox object. As with Step 2, this is just a proxy.
  6. Log in as <user>. The mailbox is the same one I started with.

My expectation is that at Step 6, I log into a fresh mailbox. Is that expectation wrong?

New Contributor

Hi,

i tried this for two days now. i create new users with on premise mailboxes and online mailboxes.
this cmd is not working, the user mailbox data is not cleared at all.

 

I read on several other sites, that i need to remove the Exchange Online (Plan 2) license.

I tried this in the Office 365 Admin center / Users / licenses and i tried this with powershell.

 

It seems, that it´s not possible to remove a assigned Exchange Online (Plan 2) without removing Offce 365 E3 license and loose all data...

can you verifiy ? 

Senior Member

I had this issue ... Tech support had no idea how to fix it.

I found this article and they even told me not to do it. As they couldn't give a reason I tried it with a "less important" account.

 

It was simple, easy and worked.

 

The steps from support were:

As the users which are having mailboxes both in cloud as well as in on premises was due to assigning the license to those users before syncing it to Exchange on premises and then after syncing the exchange on premises with cloud it resulted in soft match which in turn resulted in two mailboxes. The steps that should be done to avoid it are:

  • Remove the license of the users who have two mailboxes (both in cloud and in on prem)
  • Then move those users in non sync OU in Active directory
  • Then hard delete those users from the cloud
  • Then move the users back to syncing OU in Active directory and then run delta sync
  • This will remove the mailbox from the cloud

Happy to supply Case number off-line if you want it. @The_Exchange_Team 

Senior Member

@chad512 

If the mb is on-premises, it's still there.

Go here - https://admin.microsoft.com/AdminPortal/Home#/users

Select the user > then the mail tab

Should say something like:

This user's on-premises mailbox hasn't been migrated to ‎Exchange Online‎. The ‎Exchange Online‎ mailbox will be available after migration is completed

@JuergenB 

Removing the E3 license shouldn't remove data for 30 days (if your grace period is set correctly) ... You re-add the license after killing the mailbox.

Probably a good idea to backup OneDDrive and Sharepoint data first ... I did, but they weren't touched

New Contributor

Hi all,

great article has helped me out,

 

is there a way to pipe to a list of csv users to this ?

like   import-user C;/ cc.csv | set-user -PermanentlyClearPreviousMailboxInfo

 

Paul

New Contributor

The command worked really fine, I could do the mailbox migration of a test user.

But know I'm having the error 550 5.1.10 RESOLVER.ADR.RecipientNotFound when I want to send an email to an on-premise user. I'do not know if may be there is an issue because this situation that originally there are mailboxes in both places, on-premise and cloud.