Clarifying the public folder store removal on Exchange Server 2007
Published Nov 13 2007 02:22 PM 21.6K Views

There's been some confusion about how to gracefully remove a public store on an Exchange 2007 server, so I want to briefly review the topic and hopefully clear up a particular point. In order to remove the store, you must follow the steps described in this previous blog post:

1. Move the public folder replicas to another server. There are several ways to do this which are described in the other post.

2. Associate mailbox databases with another public folder database. Again, these steps are described in detail in the other post.

3. Remove the PF database and delete the database files manually. This is the part that trips people up. Attempting to remove the database, they encounter this error:

Remove-PublicFolderDatabase : The public folder database specified contains folder replicas. Before deleting the public folder database, remove the folders or move the replicas to another public folder database.

Now what?

Recall how this worked in Exchange 2003. When you removed a replica from a server, that server name was immediately gone when you looked at the replication tab in Exchange System Manager. However, the folder would persist in the Public Folder Instances view on that public store until all the data had replicated off. Removing the server from the replica list was only the start of the replica removal process, and ESM would not let you delete the public store until everything was gone from Public Folder Instances and the replicas had truly disappeared. The replica removal process and how to troubleshoot it was described in detail in part 3 of my replication troubleshooting series. That post describes Exchange 2003, but the process is the same in 2007.

That all still applies to Exchange 2007 - you're just using different administrative tools. When you perform step 1 above via one of the methods described, such as the MoveAllReplicas script, you've only begun the replica removal process. Remove-PublicFolderDatabase will not work until all the replicas have actually disappeared. In Exchange 2007, to see the equivalent of Public Folder Instances, you use the Get-PublicFolderStatistics command. If Get-PublicFolderStatistics still shows any folders, you won't be able to remove the public store.

So what do you do if folders are sticking in Get-PublicFolderStatistics? If they are folders that contain data you care about, you should troubleshoot the replication failure by following the steps in the post I linked to above (although you'll need to make some slight adjustments to the steps to account for the new admin tools, such as using Update-PublicFolder as a substitute for Synchronize Content in ESM). If you don't care about the folders that are stuck (for instance if they are database-specific folders such as OWAScratchPad), you can delete them with a simple command:

Get-PublicFolderStatistics | Remove-PublicFolder

That will delete the folders from the hierarchy, which will replicate to the other public stores in your environment - so again, don't do that if those folders contain data you want to keep! When the folders are deleted, or when you fix the replication problem so they can replicate off gracefully, Get-PublicFolderStatistics won't show any folders, and you'll be able to run Remove-PublicFolderDatabase.

- Bill Long

Version history
Last update:
‎Jul 01 2019 03:32 PM
Updated by: