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
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 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=<Your Organisation>,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=<your Domain>,DC=<Dot Com>
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:
CN=First Storage Group,CN=InformationStore,CN=<Your Server>,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=<Your Organisation>,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=<your Domain>,DC=<dot Com>
Which in terms of a visual representation looks like the following:

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.

You are the best!! I have been looking for a solution to this for two days and Microsoft had nothing. my situation was the same.. just checking out the product and was having trouble getting it to uninstall.
Thanks
By: Brian Bass on August 26, 2007
at 12:29 am
[...] and expand the testing so I decided to un-install the test version of Exchange 2007 that I had see here for one issue that I ran into during the un-installation process and then install a Virtualisation Product on the DL580 [...]
By: Test Lab: Virtualisation of Exchange 2007 CCR Cluster using VMWARE - Part 1 « telnet 127.0.0.1 25 on August 27, 2007
at 7:39 pm
Wow, where was this article about 3 weeks ago when i was having this same exact problem with my Exchange 2k3 deployment.
Now i am having problems with removing a failed mailbox server from the org…..
man i am ready to go back to exchange 5.5…..
By: Shon Harris on August 28, 2007
at 9:53 pm
Oh. My. God.
You are THE man …
I don’t quite know what I would have done without this little tidbit of information …
You saved my life … thankyou .. thankyou … THANKYOU!!!!
~Natalie.
By: Nat on September 7, 2007
at 4:49 am
Fantastic – thank you for your help.
Looks like M$ is just getting out of beta on this peice. It make me sad. And why is it easier to use linux commands in powershell than their new lexicon?
By: Eric Nord on September 8, 2007
at 6:11 pm
Hi,
your adsi edit program does not work on my exchange 2007 server.
By: Willie on September 19, 2007
at 9:13 am
Complimenti.
Ritengo la miglior soluzione in circolazione
By: Lorenzo Battaglia on October 1, 2007
at 10:45 am
Works great. Took me a day to find this solution! Nat says it all!!
By: gregski on November 6, 2007
at 2:06 pm
Many, many thanks to you, sir — you just provided me with an answer that several hours of Googling did not yield.
And for those of you who are looking for a bit more information about ADSI Edit, here’s the place that I grabbed my copy from:
http://www.computerperformance.co.uk/w2k3/utilities/adsi_edit.htm
-= ASPNYC =-
By: ASP NYC on November 7, 2007
at 3:31 pm
very glad i came upon this
your a genus
By: Lee Garet on November 20, 2007
at 9:43 am
You’re the Dude man!
Three hours of googling…and finally your steps worked.
Just an FYI the ADSI Edit which you had uploaded doesn’t seem to work for some reason.I got it from the 2003 CD\Support\Tools folder.
Thanks again!
Cheers,
Harish
By: Harish on December 15, 2007
at 7:41 pm
HERO!!!… can’t believe how long this took until i stumbled onto this page…
if i was gay i’d kiss you right now
By: david on December 20, 2007
at 6:40 am
Great in-depth post, I will pass this URL on
By: The Exchange Information Store on December 21, 2007
at 10:42 am
Great post! I had been struggling with the same problem for what seems like ages until I finally hit on this solution.
By: Paul on January 8, 2008
at 11:52 am
Thanks man u save me long days sitting at the table. You are the best.
By: Maciej Cichocki on January 8, 2008
at 4:40 pm
Very Very helpful!! Thanks!
By: Stefano on January 9, 2008
at 10:55 am
Well done! Great job in pulling it together! It saved my butt! Drop me a line and the beer is on me!
By: Alin on January 9, 2008
at 1:51 pm
When I wake up well-rested tomorrow morning, I’ll have you to thank for this fix. This has been on my plate for a week, and I’m eternally grateful that you posted the solution to this issue. Thank you, thank you, thank you!!!
By: Brian on January 16, 2008
at 7:32 pm
I agree with everyone – THANK YOU. I’ve been trying to get 2K7 off my domain all day, and the ADSI edit did the trick.
The MS KB articles had me going in circles, uninstalling the “official” way.
I’m glad to have this bloatware off my network (though I admit, OWA was seeeeexxxxxyyyy!!!
)
By: Rick on January 23, 2008
at 1:50 am
Make sure you register the .dll file
============
cmd prompt
c:\location of .dll file
then regsvr32 asdiedit.dll
============
now the snap in should work.
Thanks so much for the help Im also glad to see it go.
By: Matt on January 23, 2008
at 2:33 am
Took me forever before I found this! You are WONDERFUL – if you were right here – I would give you a hug!!!
I have been working to remove this – mixed in with other projects – over the past week! Had followed all of the MS KB articles how to “remove” the folder – Have tried other steps as well – They all appeared to work, but, still could not uninstall. Until now. THANK YOU!
By: Donna on January 23, 2008
at 9:01 pm
Just wanted to add my thanks for this fix
.
Stupid you cant uninstall exchange 2007 without going into adsi edit. I’m getting rid of 2007 bloatware and going back to the 2003 version which works great.
I nearly made a mistake though so just wanted to warn people not to delete their 2003 public store database entries! Its not so clear on the instructions. Always choose your 2007 Container!
By: zag on February 15, 2008
at 12:17 pm
Just want to add my thanks. I was able to remove most of it except for the hub transport. Keep telling me that unable to locate my server. If you can help me with this, I would be really appreciate.
The error I get when try to uninstall the Hub Transport Role, “Exchange server “servername.domain.com” was not found. Please make sure you have type correctly.
Because of it, I can not reinstall Exchange on my box.
Thanks
By: Dan on March 14, 2008
at 8:03 pm
hi,
this article was very helpful. I ran on the same problem and luckil, i get through this site and followed the instructions.
I have another problem and hope you can give me some help.
I have an OWA setup on exchange server 2003, published through ISA 2004. We are using RSA securID on that OWA website.
No, we are about to test/validate another form of authentication solution, so we need to create another OWA Website wherein users will log-in using the credential from that other authentication solution.
I was told that can create multiple OWA website on the same server, that I need to modify the OWA and create a virtual directory but I dont know how to do this.
So, if you can give step by step procedure on how I would do this.
Thanks.
By: laarni laxa on March 22, 2008
at 7:37 am
My sincere gratitude! Thank you!
By: Spiro R. on April 17, 2008
at 5:33 pm
Hi,
Does this means that I must re-install Exchange Server 2007 ?
my current Public Folder is pointed to wrong database location, therefore I can’t remove it
By: Albert Widjaja on May 1, 2008
at 2:10 pm
Ohh Man!
You are the best .. realy I mean it.. you saved my life.. you solution worked like a magic
RGDS
Tanvir
By: Tanvir Ahmed on May 2, 2008
at 12:40 pm
Dead on! Thanks, Dude! I’ve been struggling with this for many hours and this did it! I thought that it was just me!
By: Calgary Dude on May 5, 2008
at 7:07 pm
Terima Kasih banyak a.k.a Thank You Very Much My Friendddd, you light up my desperate way man!!!
By: Setun on May 12, 2008
at 1:25 pm
Wow. I have been working with this issue while trying to uninstall exchange role & demote a 2007 x86 machine for a week.
Thanks for the clear ADSI paths. That is what i needed.
You the man.
By: BESadmin on June 18, 2008
at 7:18 am
GRAZIE !!!
By: dierk on July 16, 2008
at 8:59 pm
Thanks dude!
The provided ADSI tool work by the way. Just unzip the two files in a folder and register the DLL. (e.g. regsvr32 adsiedit.dll)
By: Bernd on July 17, 2008
at 9:02 am
Seriously I was fighting with this for a couple hours, thank you very much.
By: Sahim on July 27, 2008
at 8:22 am
Thank You Very Much!!!!:)
By: ljolik on July 29, 2008
at 8:30 pm
Great Job Dude. Yes, it works fine.
By: Shaik Musthaq on August 9, 2008
at 12:29 pm
thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you! thank you!
SOOOO MUCH!!!!!!
By: zbenaug on August 14, 2008
at 4:14 pm
You saved my life tooo!
By: zbenaug on August 14, 2008
at 4:16 pm
you’ve saved the day. thanks
By: complexxL9 on August 27, 2008
at 8:56 am
thank you very much dude!!!!!1
greetings from Curacao Netherlands Antilles
visit . http://www.curacao.com
thank you thank you
By: ernest on September 18, 2008
at 8:21 pm
Andy Grogan for Presidient ‘08 !!!!!
By: dave on September 25, 2008
at 10:25 pm
Thanks!
By: Wes on October 10, 2008
at 3:38 pm
Hey, very good info. This worked great after I spent hours trying to remove the Exchange organization from my systems. Nice work!!!
By: Mike Gholson on October 14, 2008
at 6:30 am
Thanks man, the problem took my precious lunchtime and then some… Was going round and round MSoft in vain for hours…
You tha man!
By: Mwangi on December 11, 2008
at 1:40 pm
Thanks! It works for me.
It was a real headache!
By: David on December 11, 2008
at 6:15 pm
Excellent stuff man….. you rock..
By: Qaiser on December 15, 2008
at 6:09 am
Dude, My God!!!!!!!!!
If ever you are in sunny South Africa, you MUST give me a shout. I need to meet the man that saved my ass.
All drinks on me. Heroes should never pay for drinks!!!!!!!!
By: MikeyMol on February 3, 2009
at 10:40 pm
Thank you so much for this tip!! I see you helped many people!! Great job!
I would have been working on this forever without your help!
By: Eric on February 11, 2009
at 9:06 am
You are my hero, I have been working on this for two days. My ADSI structure was already mising the first edit, I removed the second and uninstall worked like a charm. Thank you!
By: Ken on February 11, 2009
at 3:07 pm
You are the boss:)
after so much of circus to rremove the database,
you have solution was utimate
Thanks a ton….
By: Sudhan on February 16, 2009
at 2:13 pm
Like a broken record…..
This was awesome!!!! Been working on this for a while.
Thanks again!
By: Chad Markley on March 3, 2009
at 11:39 pm
You rock, thanks so much for that…….
By: Randy Leadholm on April 10, 2009
at 6:38 pm
Mate You’re a genius!
By: KEv on April 14, 2009
at 9:17 pm
[...] kommt mir bekannt vor. Ich hab damals adsiedit zur Hand genommen. Hier ist das auch beschrieben. Quick Tip – Removing Exchange 2007 – Error with Public Folder Replicas… telnet 127.0.0.1 25 Aber bitte beachten, das ist afaik von MS nicht supported. Wenn es also kritisch ist, solltest du [...]
By: EXCH - Exchange 2007 - MCSEboard.de MCSE Forum on April 27, 2009
at 10:23 am
[...] интернете полно советов использовать в данном случае утилиту ADSIEdit, но лично у [...]
By: Пара советов по поводу удаления MS Exchange 2007 из организации « Alexx_B’s IT blog on May 5, 2009
at 10:17 am
Well, just the trick, I’ve been looking for.
I’ve got to hand it to you, son!
Well done.
By: George on May 7, 2009
at 8:42 pm
Hats off to you , even all the way from nairobi, kenya. This was flawless. After an entire day of just googling.
P.S, Technet is crappy on this issue.
By: David on May 8, 2009
at 8:10 am
Many thanks for this, I used your tip to remove Exchange2007 from a SBS2008 install. SBS2008 already has adsiedit.msc installed so I just ran that and then followed your advice.
By: Rob Mercer on May 14, 2009
at 10:26 am
I’ve been scratching my head on how to get exchange off of my soon to be decommissioned SBS 2008 server. Your “quick tip” solved an error message exchange was throwing at me when trying to uninstall!
THANK YOU!!
By: Kris Lemke on May 20, 2009
at 12:52 am
Just wanted to say a big thankyou !!!
By: Steve Buckler on June 17, 2009
at 7:02 am