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.

Recovering a deleted public folder mailbox

Secondary Hierarchy mailboxes

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:

image

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*

image

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:

  • If the disconnected mailbox contained mail-enabled public folders, mail delivery to those folders will stop working once the content mailbox is connected with the new account. A sample of the error you might see:clip_image001
  • To get the mail enabled public folders working they have to be mail-disabled and mail-enabled again. Ref : Mail-Enable or Mail-Disable a Public Folder
  • If the mail enabled public folders had some custom SMTP addresses configured they might be lost by the process of mail disabling and re-enabling. Make sure you export the details of PrimarySMTPAddress for the required mail enabled public folders and then add the custom address back to the required public folders.

Recovery of Secondary mailbox when it gets deleted from Store.

At times situations may come up where the content public folder associated mailbox account is deleted and the associated public folder content mailbox also gets deleted from the mailbox database and it needs to be recovered. The associated public folders from the associated mailbox will remain in orphaned state in the public folder hierarchy as shown below

image

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 ‘’ }

image

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.

image

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:

Recover from loss of primary hierarchy mailbox

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:

image

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:

image

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.

Recovering the primary hierarchy mailbox if it is deleted

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:

  • To avoid issues with the deletion of the container and associated public folder accounts, we can enable the feature “Protect object from accidental deletion” on the AD container and the associated objects. For more information see Preventing Unwanted/Accidental deletions and Restore deleted objects in Active Directory
  • Set proper retention settings on the database and if required at individual public folders. Also ensure to plan backups properly in the environment in case a recovery is required.
  • Recommendation would be to use the Database Availability Group for public folder mailboxes to provide much needed high availability and prevent unwanted outages.

Conclusion

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