In the last related blog post we discussed recovering public folders and its contents from dumpster when they are deleted and various recovery steps using the Outlook client and Exchange Management Shell. In this blog we will be moving further and discussing some more advanced recovery scenarios.
Secondary hierarchy mailboxes contain public folder content as well as read-only copy of the public folder hierarchy. At mailbox creation, each public folder mailbox gets associated with its own disabled active directory user account. Those user accounts should never be deleted or modified! When deletion happens though, access to public folders in that content mailbox will get disrupted. The affected public folders will still be seen in the public folder hierarchy, but they might not be accessible since the mailbox holding the folder content is unavailable.
To understand this better let’s consider a scenario where active directory user account which is associated with the Secondary public folder hierarchy mailbox gets mistakenly deleted and it needs to be recovered. The name of the secondary public folder mailbox is called PF-2 and its associated disabled user account is now gone. The associated mailbox will be available in the associated database in disabled state till the retention period expires. During that time, public folders which are hosted on the disconnected secondary public folder mailbox will still show up in Outlook because they are still present in the hierarchy. The associated mailbox content information will be unavailable for the folders associated with the affected public folder content mailbox in Exchange Admin Center as illustrated here:
In order to perform recovery for such types of issues, you will need to create a new disabled user account and reconnect the disconnected public folder content mailbox by connecting to the new created account using Connect-Mailbox.
To view the disabled mailboxes run the command:
Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisconnectReason -eq "Disabled" } | ft DisplayName,Database,DisconnectDate,DisconnectReason,*type*
If the public folder content mailbox is not listed in the disabled state but you know the account is missing, you need to force the cleanup on the store by running the below command:
Get-MailboxStatistics -Database “Database name“ | ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }
Note: Update-StoreMailboxState is the Exchange 2013 replacement for the Clean-MailboxDatabase in previous versions. When running this command, make sure you have proper retention settings in place or else you might end up purging disconnected mailboxes that you did not intend to purge!
As mentioned earlier, create a new user account with same name (like the mailbox, to keep things simpler) or, if the account has been recovered through some sort of AD recovery process, we can simply reconnect the mailbox to it. By creating account with same name the Connect-mailbox will automatically try to connect to the matching user.
Connect the mailbox using the Exchange Admin Center or Exchange Management Shell as described in the article Connect a Disabled Mailbox.
Once the mailbox is connected, the public folder should automatically start serving the contents.
Things to note about mail enabled public folders:
Note: Under usual circumstances, it is not possible to disable a public folder mailbox which is hosting the folders by using the Disable-Mailbox CMDLet. The associated folders and contents needs to be migrated to a different public folder mailbox prior to disabling it.
Let’s consider a scenario where a secondary public folder mailbox which contained a set of public folders with data has been deleted. In order to recover public folder data in such types of scenarios your only option is to restore the last full good backup for the affected mailbox.
Once the restore is completed using the recovery database, run the following CMDLet to see which mailboxes are available for recovery:
Get-MailboxStatistics –Database “Name of Recovery database”
To view a set of public folders which are orphaned in the organization run the command:
Get-PublicFolder –Recurse | Where { $_.ContentMailboxName –eq ‘’ }
Note: Before you begin with the restore process, you need to set the orphaned public folders to an active public folder content mailbox. You can create a public folder mailbox with same old name (you can get the mailbox name from the restored database by running Get-mailboxstatistics) and set the public folders to point to newly created mailbox. This can be done by executing the command:
Set-PublicFolder –Identity “\Name of the public folder” –OverrideContentmailbox “Name of the new content public folder mailbox”
If you skip above step and proceed further, the restore is going to fail since there is no target mailbox available to which data can be restored.
To set the mailbox for multiple orphaned public folders run the command:
Get-PublicFolder –Recurse | Where { $_.ContentMailboxName –eq ‘’ } | Set-PublicFolder –OverrideContentmailbox “Name of the content public folder mailbox”
Once the public folder has been pointed to an active public folder content mailbox, follow the method discussed earlier in the blog for merging the contents to required public folders from recovery database and that’s all. You should see the recovered contents in the recovered folders.
Note: In case you need to restore the contents from the entire public folder mailbox, do not use the –IncludeFolders switch. The restore process will restore the available data from recovery mailbox to all the available folders in the Target mailbox provided the folder structure is present. If you need to restore individual public folders, you can use the mentioned switch.
More information:
How to recover primary hierarchy public folder mailbox when the Active Directory account is deleted?
The primary hierarchy mailbox is pretty much the most important component when it comes to public folder hierarchy. The primary hierarchy mailbox is the one writable copy of the public folder hierarchy. The public folder hierarchy is copied to all other public folder mailboxes, but these will be read-only copies. If this mailbox is disconnected or is not accessible it will affect all the public folders access and administration. When this happens it will no longer be possible to create new public folders since the primary public folder hierarchy mailbox is unavailable.
The following error will be seen when creation of new public folder is attempted and your public folders are in this state:
If the associated account for the public folders is deleted then, the primary hierarchy mailbox will remain in the database till the retention settings expire. The mailbox will be in a disabled state. Public folders themselves will not be visible in the Exchange Admin Center as shown below:
The recovery of this mailbox is possible provided the associated primary hierarchy mailbox is available in disconnected state in the associated mailbox database. You can create a new disabled user account with same name and then reconnect the mailbox using the Connect or Restore a Deleted Mailbox command to connect the mailbox as mentioned prior in the blog.
When a primary hierarchy mailbox is deleted and past the database retention period the only option would be to restore the last full good backup for the database on which the primary hierarchy mailbox resides.
Recovering the public folder hierarchy structure would be only possible if you restore the database directly to the production or use the dial tone recovery method to recover the public folder hierarchy.
As you are recovering the database, any folder content which was modified, deleted or created after the backup of that database was taken might be lost. Once the database is restored and mounted the first thing that happens is that the primary hierarchy mailbox will initiate full hierarchy sync with all the secondary hierarchy mailboxes and only the hierarchy present from that last restored backup will be available.
Looking at the above possibility it becomes very important to plan for the high availability of public folders especially the primary hierarchy mailboxes and this is where the Database Availability Group can be the answer.
Few related notes:
In the above blog post I tried to shed some light on how to recover the contents from secondary content public folder mailboxes after they are deleted and also discussed possible scenarios when primary hierarchy mailboxes could become unavailable. I plan to continue posting some additional more complex scenarios related to recovery of the public folder mailboxes / data.
I would like to again Thank Ben Winzenz, Bill Long, Charlotte Raymundo, Nino Bilic and Bhalchandra Atre for their help in reviewing this blog post.
Siddhesh Dalvi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.