Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / Exchange / Managing Disconnected Mailboxes in Exchange Server

June 16, 2017 Exchange

Managing Disconnected Mailboxes in Exchange Server

When an Exchange mailbox or an Active Directory user account is deleted, a mailbox is not immediately deleted and is stored in the mailbox database for some time (30 days by default). Administrator can recover data from this mailbox or reassign it to another user. In this article, we’ll talk about the types of deleted mailboxes and the ways of management and restore of these mailboxes in Exchange 2010-2016.

Contents:
  • What Happens to the Exchange Mailbox After It Is Deleted
  • How to Clear Exchange Databases from the Deleted Mailboxes
  • Connecting a Deleted Mailbox to a User
  • How to Restore a Deleted Mailbox to a Mailbox of Another User

What Happens to the Exchange Mailbox After It Is Deleted

An Exchange mailbox consists of two parts: an Active Directory user account (all configuration data of a mailbox are stored in its attributes) and the mailbox itself in the Exchange mailbox database. A deleted Exchange mailbox (it may be right to say ‘disabled’) is a mailbox stored in a database, but not connected to any of the AD accounts. There are two types of deleted Exchange mailboxes:

  • Disabled – these are mailboxes disabled using Disable-Mailbox or Remove-Mailbox cmdlets (the first one disables a mailbox from an account, and the second one deletes the AD account as well)
  • Soft Deleted – the copies of the mailboxes saved in a storage after the mailbox is moved to another mailbox database. Thus, the data get additional protection from the issues that can occur during or after the mailbox is transferred to another database.

Both types of the deleted mailboxes are stored in the Exchange database before the expiration date specified by the administrator. The time, after which a mailbox is deleted, is specified in the settings of each Exchange database in Limits -> Keep deleted mailboxes for days (screenshots below for Exchange 2013 and Exchange 2010).

Exchange - Keep deleted mailboxes for days

To display the list of all available deleted mailboxes in all Exchange databases, run this command:

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -eq "Disabled" } | ft DisplayName,Database,DisconnectDate,MailboxGUID

If you need to find the deleted mailboxes in one database:

Get-MailboxStatistics –database Lon-DB1 | Where { $_.DisconnectReason -eq "Disabled" } | ft DisplayName,Database,DisconnectDate,MailboxGUID

The list of deleted mailboxes having SoftDeleted status can be obtained using the following command:

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -eq "SoftDeleted" } | ft DisplayName,Database,DisconnectDate,MailboxGUID

List of disconnected Exchange mailboxes using Get-MailboxDatabase cmdlet

How to Clear Exchange Databases from the Deleted Mailboxes

During the specified time, Exchange automatically clears the deleted mailboxes from the database. But the disabled mailboxes still take some space in a database, so during mass user migrations/removals, it may be necessary to force remove these mailboxes, thus freeing some space in the mail databases.

To permanently delete a disabled mailbox from the database, use Remove-StoreMailbox cmdlet having specified the MailboxGUID of the deleted mailbox.

Remove-StoreMailbox -Database Lon-DB1 -Identity "2532944e-8eeb-4c7e-8bd3-ee2a223b071e" -MailboxState Disabled

Remove-StoreMailbox  - removing disabled  mailboxes

To delete all disabled mailboxes in the Exchange organization:

Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -eq "Disabled"} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

If you have to delete mailbox copies left after the migration in a specific database, run the following command:

Get-MailboxStatistics –Database Lon-DB1  | Where-Object {$_.DisconnectReason –eq “Softdeleted”} | ForEach {Remove-StoreMailbox –Database $_.database –identity $_.mailboxguid –MailboxState Softdeleted –Whatif

Connecting a Deleted Mailbox to a User

A deleted mailbox may be connected to the same or another Active Directory account (obviously, the account must not have a mailbox). To connect a mailbox to the same account, run this command:

Connect-Mailbox -Identity "JSmith" -Database Lon-DB1  -User JSmith

You can perform the same operation from the EAC interface: Exchange Admin Center -> Recipients -> Connect a Mailbox.

EAC: connect deleted mailbox to a user

Tip. Don’t forget to check and correct SMTP aliases if necessary. Before you start using the mailbox, wait till Active Directory replication is over.

How to Restore a Deleted Mailbox to a Mailbox of Another User

The data from a deleted mailbox can be restored to an existing mailbox of another user using the New-MailboxRestoreRequest cmdlet (we showed how to use this cmdlet in the article about the recovery of Exchange mailboxes):

New-MailboxRestoreRequest -SourceDatabase Lon-DB1  -SourceStoreMailbox "JSmith" -TargetMailbox "Admin"

Or you can restore the mailbox by its MailboxGuid, say, to a separate folder RestoreBox:

New-MailboxRestoreRequest -SourceDatabase Lon-DB1 -SourceStoreMailbox “2532944e-8eeb-4c7e-8bd3-ee2a223b071e” -TargetMailbox “Admin” –TargetRootFolder “RestoreBox” –AllowLegacyDNMismatch

0 comment
0
Facebook Twitter Google + Pinterest
previous post
Using PowerShell PackageManagement In Windows 10
next post
Using Process Monitor to Solve a Slow Boot Problems

Related Reading

Get-MessageTrackingLog: Search Message Tracking Logs on Exchange Server

December 19, 2019

Managing Exchange Mailbox Inbox Rules with PowerShell

August 29, 2019

Fix: Outlook 2016/2013 Always Starts in Offline Mode

July 30, 2019

Configuring Anti-Spam Protection on Exchange 2013, 2016 –...

June 5, 2019

How to Blacklist/Block Sender Domain or an Email...

June 3, 2019

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • MS SQL Server 2019 Installation Guide: Basic Settings and Recommendations

    January 19, 2021
  • USB Device Passthrough (Redirect) to Hyper-V Virtual Machine

    January 15, 2021
  • Windows 10: No Internet Connection After Connecting to VPN Server

    January 13, 2021
  • Updating the PowerShell Version on Windows

    December 24, 2020
  • How to Enable and Configure User Disk Quotas in Windows?

    December 23, 2020
  • Restoring Deleted Active Directory Objects/Users

    December 21, 2020
  • Fix: Search Feature in Outlook is Not Working

    December 18, 2020
  • Zabbix: Single Sign-On (SSO) Authentication in Active Directory

    December 17, 2020
  • Preparing Windows for Adobe Flash End of Life on December 31, 2020

    December 15, 2020
  • Auditing Weak Passwords in Active Directory

    December 14, 2020

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • New-MailboxRepairRequest: Fixing Corrupted Mailboxes in Exchange 2016/2013/2010
  • How to Configure DKIM on Exchange Server 2010/2013
  • Outlook 2016: Manual Setup Exchange Account
  • Export Exchange Global Address List (GAL) to CSV
  • Calculating the Number of Client Access Licenses (CAL) for Exchange Server
  • Outlook 2016 Slow External Autodiscover with Exchange Server
  • Exchange Error “452 4.3.1 Insufficient system resources”
Footer Logo

@2014 - 2018 - Windows OS Hub. All about operating systems for sysadmins


Back To Top