I have been working on Exchange server at home 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 -Server IX -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

Failed

Error:

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: http://go.microsoft.com/fwlink/?linkid=30939&l=EN&v=ExBPA.3&id=b6e3b32a-8848-46cb-9567-72288ac15f60

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 IX “\” -Recurse -ResultSize:Unlimited | Remove-PublicFolder -server IX -Recurse -ErrorAction:SilentlyContinue

Get-PublicFolder -Server IX “\Non_Ipm_Subtree” -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server IX -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=

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