Forum Discussion

chad512's avatar
chad512
Copper Contributor
May 23, 2020

Recreate a mailbox for an existing user?

Here's what I'd like to do:

  • A mail user is created an assigned a license at some point. The user may have been synchronized from on-prem or may have been created directly in Azure AD.
  • At a later point, I want to recreate the user's mailbox without deleting the user so the user can start with a fresh mailbox.

Here's what I've tried:

  • Remove the user's license, verify the mailbox cannot be located by Get-Mailbox, add back the license. Result: the user is reattached to the same mailbox. Obviously this sequence happens within the 30-day retention period.
  • Convert the mailbox to shared, remove the user's license, add back the license. Result: the user is reattached to the same mailbox, though it is still shared.
  • Attempt to use Disable-Mailbox -PermanentlyDisable. Result: failure because the user is licensed.
  • Remove the user's license and then attempt to run Disable-Mailbox -PermanentlyDisable. Result: failure because the mailbox cannot be found.

I'm starting to think what I want to do is simply not possible, but I thought I'd fish for some fresh ideas since I'm out of them. One thought I had was to purge the deleted mailbox before the 30-day retention period is up, but I don't see a way to get a handle to it. Attempt to use Get-Mailbox with -IncludeInactiveMailbox and -SoftDeletedMailbox haven't located the mailbox for me.

  • chad512 

     

    OK, maybe a little fiddly and messy, but how about enabling the Online Archive for the mailboxes in this situation and then create a new Exchange Retention Policy In the Exchange Admin Center to move content to the archive which is older than 14 days (along the lines of the below).  Assign this new retention policy only to the users who's mailboxes you want to clear out.

     

     

    Once the move to archive has completed, disable the Online Archive for that user (making sure that you don't re-enable it for at least 30 days or the content will return).  Then, make sure you assign the default retention policy back to that user.

     

    You'd have to be very diligent about assigning this temporary policy.  It could just as easily get you into trouble if assigned incorrectly.   If you plan to give it a try, test it to the hilt first I would say.

     

  • chad512 

     

    Hi, you should be able to achieve this by purging the Deleted Users folder as you have indicated.  To do this, connect to Powershell as follows;

     

    Connect-MsolService

     

    Get-MsolUser -MaxResults 60 -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin -Force

     

    When recreating and licensing the user, you will now have a nice blank mailbox.

    • chad512's avatar
      chad512
      Copper Contributor
      My goal is to not recreate the user, though. I want the user object left as it is, but I want to recreate that user's mailbox.
      • Ah I get it. Only way I can see this working is if the user was synced from AD. Process would be:

        1). Move the user in AD to an OU which is not synced.
        2). Wait for/or force ad sync. The O365 user will be moved to deleted users folder.
        3). Run the PowerShell to purge Deleted users
        4). Move the AD user back to synced OU, run sync, and the user is recreated for you.
        5). Assign licence. Good to go.

        Maybe still not exactly what you want, but I think it is as good as you are going to get.
  • John Caldera's avatar
    John Caldera
    Copper Contributor

    chad512 

    I know this is an older post but I faced the same challenge and came across this ExO command that will achieve the desired result. Unfortunately, have been subject to this in the past and executed a permanent deletion of the account, recreate to correct the issue and then restore the content. I am so glad to come across this! I hope it referenced here will help others too.

    John

     

    https://techcommunity.microsoft.com/t5/microsoft-365/recreate-a-mailbox-for-an-existing-user/m-p/1414005#M21812

     

    • DanDan320's avatar
      DanDan320
      Copper Contributor

      John Caldera which ExO command?  You linked back to this same post.  Did you mean to send a different link?

Resources