One of the last rites of removing Exchange 2010 will be to remove the its legacy public folder database after the content has been moved to either shared mailboxes or to modern public folders.  Maybe you just decide to delete those Christmas party pictures from 1999 as an alternative to carrying the legacy content forward…

However deleting is simpler said than done.  For many years the project to review and delete public folder data has been postponed and the proverbial can has been kicked down the road.  Guess what though? That has come back and bitten many organisations who never actually reviewed and maintained the content.  Now that the end of Exchagne 2010 support is upon us, we have to migrate the legacy public folder database to something rather different.

As part of the migration, we will need to remove the original public folder database at some point.  This is part of the expected migration and Exchange 2010 decommission project.

The command to Remove Public Folder Databases is straight forward, at least on paper but sometimes there are issues.

For example, you may receive the below error:

Remove-PublicFolderDatabase "Public-Folder-Database"

Unable to Remove Exchange 2010 Public Folder Database - Replicas Present

The public folder database "Public-Folder-Database" contains folder replicas. Before deleting the public folder database, remove the folders or move the replicas to another public folder database. For detailed instructions about how to remove a public folder database, see http://go.microsoft.com/fwlink/?linkid=81409&clcid=0x409. + CategoryInfo          : InvalidOperation: (Public-Folder-Database:ADObjectId) [Remove-PublicFolderDatabase], InvalidOperationException + FullyQualifiedErrorId : 70BAB383,Microsoft.Exchange.Management.SystemConfigurationTasks.RemovePublicFolderDatabase

What are the most common reasons?

Well scroll on and we shall review them!

Zen of Exchange Management

This is a term that I have used for the last 20+ years.

Since Exchange caches information, as does IIS sometimes we need to simply allow time.    The same is also true for Active Directory.  Depending on the environment, AD replication latency may also need to be factored in.

This may take hours…..

For a large enterprise, do not expect to run through all of the decommission tasks in a 30 minute maintenance window.

Ensure All Replicas Are Moved From A Given Server

In How To Easily Add Public Folder Replicas we covered some of the build in scripts in Exchange 2010.

The quickest way to remove all replicas from a given Exchange 2010 server is to run the RemoveReplicaFromPFRecursive.ps1 script.

This allows you to remove all replicas from a given server after you have ensured that they are replicated to another server.  This is useful when working to remove specific 2010 public folder databases.

Remove All Replicas

If this is the last Public Folder Database and public folders are not going to be migrated to Exchange 2013/2016 then we can use the below to remove all user public folders and the Exchange 2007/2010 system public folders.

Get-PublicFolder -Server Exch-2010 "\NON_IPM_SUBTREE" -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server Exch-2010 -Recurse -ErrorAction:SilentlyContinue
Get-PublicFolder -Server Exch-2010 "" -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server Exch-2010 -Recurse -ErrorAction:SilentlyContinue

Removing Exchange 2010 Public Folder Replicas Using PowerShell

Ensure All Mailboxes Migrated

This should have been done already, though some mailboxes could have been created on Exchange 2010 and potentially are configured to use an Exchange 2010 public folder database.

Once mailboxes are moved, delete the Exchange 2010 mailbox databases.

Removing Exchange 2010 Mailbox Database Using PowerShell

Remove Public Folder Database

Now that we have the remediated the issue, the public folder database can be removed.

Removing Exchange 2010 Public Folder Database Using PowerShell

Caution

Do not use ADSIEdit to remove the public folder unless instructed by Microsoft support.  There is no error checking or validation performed.

Cheers,

Rhoderick