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.
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.