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 Exchange 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:
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
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.
Remove Public Folder Database
Now that we have the remediated the issue, the public folder database can be removed.
Do not use ADSIEdit to remove the public folder unless instructed by Microsoft support. There is no error checking or validation performed.
"NON_IPM_SUBTREE" is missing a backslash
That was caused on a number of posts when the content was migrated out of the old location on TechNet. I've been fixing as I see them, but no great way to do a bulk operation 🙁
Rhoderick I wish I would have found your article during our decommission of an Exch 2010 server. I don't recall the exact error we had during the decommission process but we did have trouble removing the public folder DB.
Unfortunately we did use ADSI edit to remove the the DB so that the Exch uninstall would complete. Other than that everything went fine but this week we have noticed that an email address from old "mail enabled" public folder is still lingering and we wanted to use it else where.
Error - The proxy address "smtp:itsupport@DOMAIN.com" is already being used by the proxy addresses or LegacyExchangeDN of "DOMAIN.com/Microsoft Exchange System Objects/IT Dept". Please choose another proxy address.( The "PublicFolder" with display name "IT Dept" is already setup and using the same address.)
We decided not to continue with public folders on the newer Exch 2016 server so not sure how we resolve this now. Any thoughts would be greatly appreciated.
We are not using public folders in our exchange 2016 environment.. Do we need to use ADSIedit to remove the PF to remove the setting on each exchange 2016 database, or when the PF gets deleted it gets removed from there as well?
and to confirm exchange 2016 would not be using the PF for anything? only exhcange 2003 used PF for free busy look ups etc?
this did not work for me. I ended up dismounting, copying the Public folder and logs deleting the orginal
mount-database PF1 -force
then i was able to delete the database cleanly.