Mailbox not removed even after license removal

Surya kumar 370 Reputation points
2025-07-31T10:31:09+00:00

Hello,

The license is no longer present to the account; however, mailbox is still showing up in exchange online and there is a correlation error in M365 admin center.

There is a retention policy applied to the mailbox. Is there any way that we can delete the mailbox by keeping the user account? We are having hybrid environment and the account was created in AD

Remove-mailbox //will delete both account and mailbox

As per checks, the retention policy would only prevent from being hard deleted.
The remoterecipienttype showing as None

Can some one share how to remove this mailbox from the user account?

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 121K Reputation points MVP Volunteer Moderator
    2025-07-31T11:20:46.25+00:00

    You have to exclude the mailbox from any retention policies and or holds. You can either do this in Purview by adjusting the corresponding policies, or via the Set-Mailbox cmdlet and the -ExcludeFromAllOrgHolds parameter, however the latter only works for org-wide policies, as the parameter name suggests.

    After you have excluded the mailbox from any holds, it will be automatically removed, but you can also use the Disable-Mailbox cmdlet to speed things up. Unlike Remove-Mailbox, the Disable-Mailbox cmdlet will not affect the user object.


  2. Hin-V 2,000 Reputation points Microsoft External Staff Moderator
    2025-07-31T11:53:22.6066667+00:00

    Hi @Surya kumar

    Thank you for posting your question in Microsoft Q&A. 

    Based on your description, we understand that you have considered to remove the mailbox from the user account without deleting that account. We are glad to assist you this part. der within  

    You could follow these steps to troubleshoot it: 

    Using Exchange Online PowerShell (connect via Connect-ExchangeOnline).  

    Note: These actions are irreversible, please back up any needed data first via eDiscovery or export tools. 

    Step 1: Disconnect the Mailbox from the User Account 

    This clears the mailbox GUID association, resolving any sync mismatches and allowing the user account to remain intact without a mailbox. The mailbox will become disconnected and inactive due to the retention policy. 

    Run the following command (replace ******@domain.com with the user's primary email or UPN): 

    Set-User <******@domain.com> -PermanentlyClearPreviousMailboxInfo 
    

    You'll get a confirmation prompt warning that this is destructive. Type Y to proceed. 

    After running this, force an Azure AD Connect sync on-premises (e.g., via Start-ADSyncSyncCycle -PolicyType Delta in the sync server PowerShell) to propagate changes. 

    Verify: The user should now show no mailbox in the Microsoft 365 admin center or via Get-User ******@domain.com | FL mailbox. The correlation error should resolve as the mismatch is cleared. The old mailbox will appear as inactive via Get-Mailbox -InactiveMailboxOnly. 

    This step alone "removes" the mailbox from the user (it's no longer linked), but the inactive mailbox persists in Exchange Online due to retention. 

    Step 2: Identify the Inactive Mailbox and Its Holds 

    Find the inactive mailbox (replace with the original alias or search by name): 

    Get-Mailbox -InactiveMailboxOnly -Identity <oldalias> | FL Name, Alias, ExchangeGuid, LegacyExchangeDN, Hold 
    

    Note the ExchangeGuid (you'll use this as the identity for later commands). 

    Check for holds/retention details: 

    Get-Mailbox <ExchangeGuid> -InactiveMailbox | Select-Object -ExpandProperty InPlaceHolds 
    

    This lists hold IDs. Cross-reference with Get-OrganizationConfig | Select-Object -ExpandProperty InPlaceHolds for org-wide holds. 

    For eDiscovery or compliance holds: Connect to Security & Compliance PowerShell (Connect-IPPSSession) and run Get-RetentionCompliancePolicy or Get-CaseHoldPolicy to identify specifics. 

    Step 3: Remove Holds and Retention from the Inactive Mailbox 

    The retention policy prevents hard deletion, so exclude or disable it. Process one hold type at a time, and wait 15–30 minutes between steps for changes to apply (holds can take time to release). 

    • For Litigation Hold: 
    Set-Mailbox <ExchangeGuid> -InactiveMailbox -LitigationHoldEnabled $false 
    
    
    • For Delay Holds (common after recent policy changes): 
    Set-Mailbox <ExchangeGuid> -InactiveMailbox -RemoveDelayHoldApplied 
    
    
    • For Organization-Wide Retention Policies (most common for preventing hard deletes): 
    Set-Mailbox <ExchangeGuid> -InactiveMailbox -ExcludeFromAllOrgHolds $true 
    
    • For Specific Retention Policies or Labels:  

    If it's a targeted policy, use Set-RetentionCompliancePolicy -Identity <PolicyGuid> -RemoveExchangeLocation ******@domain.com

    • For eDiscovery Case Holds:  

    Use Set-CaseHoldPolicy -Identity <PolicyName> -RemoveExchangeLocation ******@domain.com

    • For App-Specific Retention (e.g., Teams/OneDrive if applicable):  

    Temporarily disable the policy via Set-AppRetentionCompliancePolicy -Identity <PolicyName> -Enabled $false, wait up to 24 hours, then re-enable after deletion. 

    Re-run the hold check command from Step 2 after each change to confirm removal. If any holds remain, the deletion will fail. 

    Step 4: Permanently Delete the Inactive Mailbox 

    Once all holds are removed, the mailbox becomes soft-deleted. You can then purge it immediately: 

    Run: 

    Remove-Mailbox <ExchangeGuid> -PermanentlyDelete -Force 
    

    Verify it's gone: Get-Mailbox -InactiveMailboxOnly -Identity should return nothing. 

    Note:

    Hybrid Considerations: Since the account is AD-sourced and RemoteRecipientType is None, this indicates the mailbox wasn't properly set as a remote mailbox on-premises (e.g., via Enable-RemoteMailbox). The above steps handle it as a cloud-disconnected mailbox. If sync errors persist post-Step 1, check Azure AD Connect health for conflicts and consider resetting attributes like msExchMailboxGuid on-premises via ADSI Edit (set to null, then resync). 

    Permissions: You need Exchange Admin or Compliance Admin roles. If errors occur (e.g., "can't find mailbox"), double-check the GUID. 

    If you need further assistance, please  let us know.


    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.