Before you can uninstall Exchange Server 2010 from a server you must remove all databases, including public folder databases.
A public folder database can’t be removed until it no longer hosts any public folder replicas. If you try to remove it while it still hosts replicas you’ll receive an error message.
——————————————————–
Microsoft Exchange Error
——————————————————–
The public folder database ‘PF-BR-01′ cannot be deleted.PF-BR-01
Failed
Error:
The public folder database “PF-BR-01″ 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=0×409.——————————————————–
OK
——————————————————–
Microsoft has provided some PowerShell scripts with Exchange Server 2010 for public folder management. They are located in the \Scripts folder of the location that Exchange is installed.
Launch the Exchange Management Shell and run the following command to navigate to the \Scripts folder.
[PS] C:\>cd $env:exchangeinstallpath\scripts
Now inspect the public folder replicas to see whether the public folder database you’re trying to remove is the only replica, or if there are other replicas as well.
Get-PublicFolder \ -Recurse | ft name,parentpath,replicas
Name ParentPath Replicas
---- ---------- --------
IPM_SUBTREE {}
All Staff \ {PF-HO-01, PF-BR-01}
CEO \All Staff {PF-HO-01, PF-BR-01}
Social Club \All Staff {PF-HO-01, PF-BR-01}
Branch Office \ {PF-BR-01}
Admin \Branch Office {PF-BR-01}
Sales \Branch Office {PF-BR-01}
Head Office \ {PF-HO-01}
Admin \Head Office {PF-HO-01}
Finance \Head Office {PF-HO-01}
Sales \Head Office {PF-HO-01}
Service \Head Office {PF-HO-01}
Internet Newsgroups \ {PF-BR-01}
As you can see above the PF-BR-01 public folder database is the only replica for a few of the public folders. If the folders are no longer needed they can simply be deleted. Otherwise we need to move those replicas to another public folder database if we want to keep those folders. The MoveAllReplicas.ps1 script is provided for this task.
.\MoveAllReplicas.ps1 -Server esp-br-ex2010 -NewServer esp-ho-ex2010a
You may need to wait a while for this change to take effect depending on how many replicas you’re trying to move.
You also need to ensure that no mailbox databases are configured to use that public folder database. You can check this quickly using the following command.
[PS] C:\>Get-MailboxDatabase | ft name,publicfolderdatabase
Name PublicFolderDatabase
---- --------------------
MB-HO-01 PF-HO-01
MB-HO-02 PF-HO-01
If the public folder database doesn’t appear in the list then no mailbox databases are using it.
You’ll also need to make sure that the server is not the OAB generation server for any Offline Address Books that are also being published to public folders.
[PS] C:\>Move-OfflineAddressBook "Default Offline Address List" -Server ESP-HO-EX2010B
You can also disable public folder distribution of the OAB if you no longer have Outlook 2003 clients on the network.
Finally, if you have multiple public folder servers in your environment check whether there are custom public referral lists configured on any of them. If you remove a public folder database that is in another server’s custom referral list it can cause an error that the public folder store is in an inconsistent state.
Get-PublicFolderDatabase | where {$_.customreferralserverlist -like "*esp-br-ex2010*"}
Once all of these conditions have been met you should be able to remove the public folder database.
If you still can’t remove it and you’re sure the public folder database contains no more replicas you can use ADSIEdit to remove the public folder database from the organization.
Original post is on ExchangeServerPro.