How to Remove a Public Folder Database in Exchange Server 2007 RTM

Published Jul 09 2007 12:50 PM 72.3K Views

At Exchange Support one of the most common support issue that we see is Exchange 2007 uninstall failing due to presence of Public folder replicas. When you try to Remove Exchange 2007 using the "Add/Remove Programs" from control Panel you would get an error:

The public folder database Database_Name cannot be deleted.
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.

You get this error because you cannot delete a public folder database that contains data. To remove data from a public folder database, delete any unnecessary public folders, and then move the remaining folder replicas in that database to a public folder database on another server. If this is the last public folder database in your Exchange organization then you should remove all public folder instances before you can remove the public folder database.

So how do we remove public folder replicas from the database? We have documented steps and the links to those are below:

How to Remove a Public Folder Database

How to Remove the Last Public Folder Database in the Organization

KB 927464 How to remove Exchange 2007 from a computer

We still receive several support calls in execution of these steps. This 2 part blog series provides you detailed steps on how to remove public folder replicas. In this blog we will consider a coexistence environment with Exchange 2003. The step by step instructions are provided to remove public folder replicas using graphical user interface (GUI) as well as using Exchange Management Shell. This scenario is also applicable in coexistence environment where you have an additional public folder database on Exchange 2007 server to move your replicas. In pure Exchange 2007 environments with multiple public folder databases you will have to use Exchange Management Shell to perform all the tasks. These steps are also discussed in detail. In the next blog we will discuss how to remove the last public folder database from the organization.

To perform the tasks, the account you use must be delegated Exchange Organization Administrator role.

To remove a public folder database we have 3 main steps:

Step 1. Move the public folder replicas to another server

GUI Approach – This is applicable to coexistence scenarios where you can use Exchange System Manager from Exchange 2003. We will use combination of Exchange 2003 System Manager and Exchange 2007 System Management Console to complete the steps.

1. To check the public folder contents in Exchange System Manager, go to Exchange Administrative Group containing Exchange 2007 servers. Browse to Public Folder Database and then click on Public folders. On the right pane you will see all the public folders on your Exchange server including some System Folders

2. To Move all folders to another database on another server Right click on "Public Folder Database" and choose "Move All Replicas"

3. Select the server where you want to move all the public folder replicas in the Public Folder store.

4. You will also confirm on the Warning that it may take several hours for the Move to be completed. To verify that the folder contents have been moved, check the list of "Public Folder Instances" in the store is empty.

5. If you get an Error as below it means you have SSL enabled for ExAdmin Virtual directory (Enabled by default in Exchange 2007). If you do not get this error skip to Step 7.

The requested operation is forbidden.
ID no: c1030af1
Exchange System Manager

6. To disable SSL on your ExAdmin Virtual root, use IIS Manager Snap in and connect to your Exchange 2007 server. Under "Default Web Site" browse to ExAdmin virtual directory and go to its properties. Go to "Directory Security" tab and under "Secure Communications" click "Edit". Uncheck the box "Require secure channel (SSL)".

7. Now repeat steps 2-4 to Move your public folder replicas. While the hierarchy changes are made to move the replicas you would see the Progress bar.

Once the hierarchy changes are completed the "Public Folder" Node will show no content as below. In the background the content replication would place which may take several hours or several days to complete. In case replication stall or isn't progressing refer to the blog entry by Bill Long to diagnose public folder replication problems:

8. To verify that the content replication is complete, you must look at node "Public Folder Instances". Once all the public folder replicas have been moved the "Public Folder Instances" would be blank.

Note: If the source database is dismounted before all its contents are moved, repeat the steps again. A dismount of database would create the system folders again and would block removal of Public Folder database.

Depending on the replication interval you have set and the amount of information that must be replicated, this process may take several hours or days to complete.

You should check your queues to make sure that the replication messages are routed to the appropriate server. If there are messages destined to the target server in your queue troubleshoot the transport issues first.

Management Shell Approach - These steps are applicable to all environments. In pure Exchange 2007 environment this is the only method to move public folder replicas to a different database.

1. To get a list of the public folder replicas in the database using Exchange Management Shell, run the following command

Get-publicfolder \ -recurse |ft Name,Replicas

To get a listing of all system folders on this database, run the command

Get-publicfolder \NON_IPM_SUBTREE -recurse |ft Name,Replicas

2. To Move all folder replicas or instances to another database use the Moveallreplicas.ps1 script on your Exchange server. The script is located under Scripts folder.

Set-Location "C:\Program Files\Microsoft\Exchange Server\Scripts"

.\MoveAllReplicas.ps1 -Server MySourceServer -NewServer MyTargetServer

3. This script operates by modifying the public folder replicas in a server's public folder hierarchy table. When you run the script, first the hierarchy changes are replicated, and then the contents of the public folders are replicated. When you run this script, both the source and target servers must have a public folder database, and at least one of them must be a Microsoft Exchange Server 2007 Mailbox server. When you run this script, mailflow between the two servers must be functional for replication messages to flow between the servers..

When the script completes in the Exchange Management Shell, wait until all content is moved to the new server. This can potentially take several hours to several days to complete. In case replication stall or isn't progressing refer to the blog entry by Bill Long to diagnose public folder replication problems:

To check how many folders remain to be moved to the new server, run the following command.

Get-PublicFolderStatistics -Server <server with public folder database to be removed>

A successful completion of content replication is indicated by "No Results" from this command. If you still see some folders you need to wait for content replication to complete.

If the source database is dismounted before all its contents are moved, remount the database and run through steps 2 through 4 again.

Step 2. Associate mailbox databases with another public folder database

If any mailbox databases are associated with the public folder database that is to be removed, you must configure another public folder database as their default public folder database.

1. Identify all mailbox databases that use the public folder database that you want to remove as the...

2. Use Exchange Management Console to select another public folder database as the default public folder database for the mailbox databases that you identified in Step 1.

3. Repeat Step 2 for all mailbox databases identified in Step 1.

Step 3. Remove the PF database and delete the database files manually

1. Now you are ready to remove your Public folder database. To remove a public folder database click on your Public folder database and under Actions select "Remove":

2. You get a prompt to confirm your Action.

3. A warning appears, indicating that the database was removed and reminding you to manually remove the database file.

4. Browse to the folder specified in the Warning message and delete the .edb file from the folder.

- Atul Saini

Not applicable
Very helpful. Thanks!
Not applicable
I've had this issue on a CAS/HT box, which also happened to have the mailbox role as it was the first-built E12 server.  Once I had my CCR mailbox cluster running, I wanted to remove the mailbox role, but couldn't due to there still being a PF replica.

I ended up having to call PSS after trying everything listed in the article above.

I'm still not sure exactly what fixed it out of these two:

(1) installing Update Rollup 2 for E12
(2) recreating a mailbox database ( I had previously removed all mailbox DBs and stores on the server)

I assume it was the latter, and this enabled the PF to replicate properly to the new mailbox server.

Thanks for the post though, it's nice that others who encounter this problem will be able to find all this information in the one place!
Not applicable
Thanks for the post.

I'm having an issue with moving the system folder replicas back to my 2003 server.
All normal public folders are done, but the system folders remain.

I just want to decommission the 2007 server. Is there a way to force removal of this folders? They do not contain any items as i can see in the system manager.
Not applicable
There is no force removal of the folders. Please check the output of

Get-publicfolder NON_IPM_SUBTREE -recurse |ft Name,Replicas
to verify that there are no more replicas of system folders on Exchange 2007 server.
Not applicable
I have tried this several times to no avail - the replicas for the OAB and Schedule+ Free Busy (for the Exchange 2003 environment) will not replicate.  Is there a way to forcably remove the replicas if loss of data is not a concern?  We are trying to uninstall the Exchange 2007 server in the environment and no relevant data is on the server but the installer will not proceed since it thinks there are replicas.  Going around in circles.  Any feedback would be great!
Not applicable
Is there any way to migrate Public folder from E2K3 to E2K7 across the organization (Cross domain migration of Public folders?)
Not applicable
Not applicable
Ok I have been thru this like 100 times and I was was  missing something.
I installed my First Exchange 2007 on a non AD machine to test things out. Since it worked good I installed Exchange 2007 on my production machine, moved over the mailboxes and connectors, created a new Public folder, and moved the replication publicfolder items over as per insructed. However I still get the error when I do it from the command line or GUI- When I go to remove it says it's in use by a mailbox store.

When I run Get-PublicFolderStatistics -Server <server with public folder database to be removed>

it returns nothing which is what I want.

SO that leads me to how to do this ?
Identify all mailbox databases that use the public folder database that you want to remove as their default public folder database.

Which isn't very clear. In actuallity it is pretty simple - go to the GUI and select Each mailbox store under each storage group on each server.  Right click, select properties, and Client Tab.  make sure the clients are not assigned to the Public folder you a getting rid of.

Man I wasted 1 day on this. And it was so easy in the end.

Not applicable
How do you do this if you have Exchange 2000 instead of Exchange 2007?  

My situation is as follows:  Had an exsisting Exchange 2000 server and wanted to migrate to Exchange 2007.  I installed the new server hardware and Exchange 2007, but I now need to uninstall Exchange 2007 without doing damage to the Exchange 2000 server.  
Not applicable
For migrating PF folders across domain using ExchangeSync utility, how can I use this tool using command line. Can I generate the configuration file using custom application instead of exscfg.exe
Is there any command line interface / commands using which I can specify the public folder for migration?
Version history
Last update:
‎Jul 01 2019 03:29 PM
Updated by: