Removing Exchange 2007 – Error with Public Folder Replicas

by Andy Grogan on December 3, 2008 · 8 comments

in Exchange 2007 (General), Exchange 2007 (Installation), Exchange 2007 (Public Folders)

I have been working on Exchange server in a lab for a little while, and today I decided that I wished to take my testing a stage further which involved removing my current, very basic installation of Exchange 2007 from the server I have been working with.

Before I ran the Exchange 2007 Setup utility I removed all of my 1000 Exchange mailboxes from the OU that I had setup in my test lab using the following command:

Get-Mailbox -OrganizationalUnit “Infrastructure.local/Exchange-Users” -ResultSize Unlimited | Remove-Mailbox

I then disabled the Administrators accounts mailbox using the following command:

disable-mailbox administrator

I then deleted the instance of the Offline Outlook Address Book that I had been using in the ESM, along with the additional Exchange Databases and Storage groups, as I hadn’t been using any connectors I did not have to find or remove these.

It was at this point that I thought I would remove Exchange from the server, so I went to “Add Remove Programs” in the Control Panel and selected Exchange 2007 and then Remove.

The setup process began, and as expected performed its initial inspection of whether the Exchange installation was suitable for removal – but when checking the Mailbox role setup failed with the following error message;

Mailbox Role Prerequisites



Uninstall cannot proceed. Database ‘Public Folder Database’: 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.
Recommended Action:

I thought ok, no management interface in this version of Exchange for Public Folders, so there must be a management interface command that will work, so I opened up my trusty friend Google and did a search and found the following commands:

Get-PublicFolder -server XEON “\” -Recurse -ResultSize:Unlimited | Remove-PublicFolder -server XEON -Recurse -ErrorAction:SilentlyContinue

Get-PublicFolder -Server XEON “\Non_Ipm_Subtree” -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server XEON -Recurse -ErrorAction:SilentlyContinue

Both commands seemed to run fine (obviously I might not see any specific processing errors due to the “SilentlyContinue” switch) – however when I returned to Remove Exchange I ran into exactly the same error message.

I suspected that perhaps some replicas had been missed by the Management Command – but I was running short of time and really needed to remove the Exchange Installation from the Machine so I thought – perhaps I could just remove the reference to the Public Folder from Active Directory.

So I broke out my trusty copy of ADSI Edit (which can be downloaded from here) and navigated to the following entry:

CN=Folder Hierarchies,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=,DC=

For visual reference it may look the following in ADSI Edit:


When I had this key selected the right hand pane of ADSI Edit changed to display the following value:


I Right clicked on that value and then chose “Delete” from the context menu.

I then navigated to the following key in ADSI Edit:


When I had this key selected I saw the right hand pane of ADSI Edit change to look like the following:


I then right clicked on the correct entry for my Public Folder Database and then chose “Delete”.

It was then I re-ran Exchange setup, and on this occasion it worked perfectly.


{ 8 comments… read them below or add one }

Adrian January 14, 2012 at 1:59 am

Thanks very much for this article. I have been trying to remove the legacy 2k7 in a coexistant 2k10 environment. I got this error and have tried a lot of things with the help of the mighty google and no luck. This took care of it with one exception. I did not remove the object in the first example, since this is a production environment I only want to try things I was sure was sure was only directly tied to the server I could not uninstall exchange on hosting the Public Folder database. Your second example under the cn for the server name worked perfectly.



Joachim Otahal July 26, 2012 at 12:23 pm

Thanks, I tried to completely remove the exchange 2007 (migrated from formerly Exchange 2003), and some public folders which were completely inaccessible by anyone blocked a lot.


Judith Carrion July 26, 2012 at 9:18 pm

I was very complicated by this problem for several days. Thank you very much this article.


Vanya March 5, 2013 at 2:47 pm


I have the same issue,but my problem involves that the previous administrator created a test exchange aswell,and we want to remove this server now,but without effecting our live production server.I have be able to remove all the unwanted storage groups and databases,but the public folder database doesnt exist anymore,so I cant remove it.

Please help


John Albrektson August 23, 2015 at 10:15 pm

Thanks SO much for this!


Bernard September 17, 2015 at 11:37 am

Amazing, thanks so much! Been fighting with this for last couple hours, and this worked like a treat 🙂


Alejandro April 29, 2016 at 3:12 pm

You rock we spend a lot of time researching and trying difference option and non of them work until we find this article. Thanks for the help/


J October 21, 2017 at 4:56 am

It worked like a champ!!


Leave a Comment

Previous post:

Next post: