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.

How to Remove an Exchange 2010 Public Folder Database
Exchange 2010 public folder database can’t be removed

——————————————————–
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=0x409.

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

How to Remove an Exchange 2010 Public Folder Database

If necessary move the OAB generation to another mailbox server.

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

How to Remove an Exchange 2010 Public Folder Database
Removing Exchange 2010 public folder database with ADSIEdit.msc

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. dennis

    Hello,
    I’m having a difficult time moving all Exchange functions to a 2010 sp3 box from a 2010 that’s not even sp1. I can’t remove Public folder replica’s and I’m not sure it’s even needed as we don’t use Public Folders. I just want to make sure our GAL, OAB and all address lists are moved. What’s worse is no matter what I try, I can’t get mail to stop going to the old server. It’s not a source server on the SMTP send connector and all of it’s receive connectors are disabled. Yet, messages find their way into the old Exchange queue so I have to add it to the Send Connector to push out email.
    Let me know if this is something you can fix and what your rate would be.

  2. Todd

    To add to the above issue. A deletion of a folder on PFServe2 is replicated to PFServer1, which is a huge issue, obviously.

  3. Todd

    Regardless of how the replicas are defined in our Exchange 2010 environment, a folder on PFServer1 gets replicated to PFServer2. If a new folder is created on PFServer1, and PFServer1 is the only replica listed, it will still show up onPFServer2, and vice versa. If i change replica members on PFServer1, those changes are replicated back to PFServer2. the PF’s are identical for folders and content on PFServer1 and PFServer2.

    Does the MoveAllReplicas.ps1 change those properties somehow? All I want to do is delete a DAG with 3 servers, one of which contains PFServer2.

  4. Sean

    Hi Gents

    For reference I used this PowerShell to remove my replicas.

    1 Remove all Public Folder replicas from the server using the following command:

    Get-PublicFolder -Server “SERVER NAME” “\” -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server “SERVER NAME” -Recurse -ErrorAction:SilentlyContinue

    2 Next, remove all System Folders using the following command:

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

    1. Straland

      Awesome, it worked great

  5. Omar

    Thanks .. great article .. trying it tonight

  6. Satish Patel

    You can easily remove PF Database from below PS

    Remove-PublicFolderDatabase -Identity “PFDB Name” -RemoveLastAllowed

  7. Satish Patel

    You can remove PF Database with below PS

    Remove-PublicFolderDatabase -Identity “PFDB Name” -RemoveLastAllowed

    1. Kr Donchev

      That’s really works and no need ADSI

  8. K.S

    Get-PublicFolder non_ipm_subtree -Recurse | fl name,parentpath,replicas

    Under Tools open public folder management and check replica information.
    Add the view if necessary
    Then remove your public folder database anywhere it is shown
    Once completed try removing the database again via the EMC
    Worked for me.
    Thankyou A.R

  9. A.R.

    Thank you for a great article!
    In my case replica that did not allow to delete PF DB base was in system folders, not user ones.
    Get-PublicFolder non_ipm_subtree -Recurse | fl name,parentpath,replicas > system_folders.txt

  10. Tiana Westling

    I have a few questions that weren’t clarified in the instructions:

    I’m virtualizing our Exchange 2010 environment and need to migrate the PF’s from the physical to the new virtual. This is a 2010 to 2010 migration.

    1) Does it require us to first install a new, empty PF on the other server?
    a. If no, will it give us the ability to let us set the partitions we want the db and the logs to sit in, during the script run?
    2) Does it say there will be outage/downtime while this runs?
    3) Are there any caveats to replicating moderated and/or mail-enabled folders?

    Thanks in advance!!
    Tiana

  11. SS

    Hi Tim Baker,

    Where you able to get solution for your issue.. I am in the same situation as you.
    I wish to remove the One Exch 2010 PF server due to old hardware.
    Have replicated all the data to new server. If I stopped the services on the old server, mail are not getting delivered on the mail enabled PF.

    As soon as bring up the services on old server mails are delivered to PF.

    However if I see property of Mail enabled PF I don’t see the replica for this Old server.

    Any help will be appreciated.

  12. Sunil

    after removing PF database when I click on folder option on outlook. It is showing public folder with no data & when I click on it prompt me error

    cannot expand the folder. The public folder could not be opened because the organization you are connected does not support public folder.

    can you please tell me is this outlook folder.

  13. Sunil

    Hi Paul,

    I removed PF association from mail box database & also have removed PF databases form ADSIEDIT, but still user are able to see in outlook.

    Any suggestion

  14. Frank

    This worked for me:

    My workaround:
    – Dismounted the public folder database
    – Renamed/moved its files (ebd+log)
    – Mounted the database and said “yes” to the recreate warning
    -Delete Public Folder Database

    Test ok with exchange 2010

    1. Chris

      Thank you Frank!!

      Worked for me 🙂

      1. Chris

        This was on Exchange 2007 BTW 🙂

  15. agoinerz

    Nice! Rak n roll to da world! whooooo!

  16. Elie Abou Nader

    Thanks a Lot.
    i used the ADSI Edit to remove the database because i deleted all the public folders and still cant remove the database.

  17. Rob

    Discovered that this will work…..at least on Exchange 2010 SP3

    get-publicfolderstatistics -server -resultsize unlimited | remove-publicfolder

    I used the -whatif parameter on the end of this command to confirm that it would do what I wanted
    it to do and then ran the command without the -whatif parameter.

    I know this seems simple in retrospect but I had a similar situation go horribly wrong a few years back necessitating the restore from backup of several thousand public folders……I’m a little gun-shy now.

  18. Turbomcp

    my mistake
    I think your right I forgot my environment was “pure” 2010 in migration I think the name is right(if it was migrated from 2007 to 2010 for example.

  19. Turbomcp

    Hi Paul
    First thanks again for all your hard work
    I was looking for something and stumbled across this article
    and noticed you have a small typo here:
    Move-OfflineAddressBook “Default Offline Address List”

    should be:
    Move-OfflineAddressBook “Default Offline Address Book”

    🙂

    Thanks again

  20. Rob Coleman

    I am cleaning up our gargantuan Public Folder Database. I am moving all the selected folders to a database created for the purpose on a single server (Van-MB3). I am doing this by removing all of the replicas on the folders for other serves and adding a replica to this new database only. So far so good.

    I now want to delete the folders IN THIS DATABASE ONLY but keep the database alive as I am doing this in a rolling process and still have lots of folders to move to it.

    Is there a powershell command that will delete ONLY the folders in the Public Folder Database on this one server. (Van-MB3) and not interfere with the heirarchy . I can’t really delete one folder at a time because there are hundreds and hundreds of them.

    1. Paul Cunningham

      After you have removed the replica from that server it no longer holds a copy of that folder’s contents.

      1. Rob Coleman

        Thanks a lot….to confirm that we’re on the same page (sorry, I can be kinda slow ), I have removed ALL of the replicas except the one on this particular server. If I remove the last replica (didn’t know it would let me do that) the folder is effectively deleted from the environment….correct?

        BTW: some fantastic photos !

        1. Rob Coleman

          Turns out Exchange won’t let you delete the last replica so that idea is no good. What’s more, when I getpublicfolderstatistics -server van-mb3 the output doesn’t include the path so with thousands of public folders & subfolders I have no easy way of finding where a particular public folder in the above report is located in order to delete it manually.

          Nice !

          If I delete the database and all it’s contents using adsiedit…….will this delete the public folders that have a replica in that database only or will it completely screw things up.?

      2. Robert

        Thank You Paul. this was the obvious point that I needed confirmed:

        Paul Cunningham says

        June 12, 2015 at 10:03 am

        After you have removed the replica from that server it no longer holds a copy of that folder’s contents.

  21. Tim Aitken

    Hi All,
    I was having this problem removing the last Public Folder database from Exchange 2010 after migrating to Exchange 2013.

    I had followed all the steps to remove the public folder but still couldn’t remove it. Research eventually led me to this command (The last comment on this page: https://social.technet.microsoft.com/Forums/exchange/en-US/c1e51bd0-51e4-45d1-b1f6-e1eb5f2b4b2f/delete-last-public-folder-database):

    Set-OrganizationConfig -PublicFolderMigrationComplete $True

    After setting that I could successfully remove the public folder from the EMC on Exchange 2010.

    Hope this helps.

    Tim

    1. Transmo

      This worked for me. Thanks.

    2. Doodleman99

      This worked for me!
      the DB wasn’t even showing in ADSIEdit only my new databases were there.
      i even tried unmounting, renaming the files and then remounting to force a recreation of a new DB but still no joy.

      many many thanks!

    3. DrDave

      OMG THIS!! thank you!! Nothing was working.

    4. guy

      Thanks Fixed it for me too

    5. Jason Young

      Many thanks
      I have been trying to clean up for the mess for days.

    6. Bogdan NEMTANU

      This worked for me. Thanks.

  22. Raj

    Hello Paul,

    I have to remove a public folder database and server from our exchange environment. This is an old exchange 2010 (A) server that holds some 200gb of obselete data which is not being replicated over to 2 (B and C) other newly built exchange 2010 PF servers. Can I use Exfolders to stop replication to this server? mailbox databases are pointed to server B. Here is my step by step:
    1. Stop replication to Server A. Ensure it completes. Ensure server B and C has the relevent PFs that is required for business by running the get- publicfolderreplicationreport script.
    2. Dismount the PF database on Server A. Allow sufficient time to ensure there are no errors or PF availability issues for end users.
    3. Uninstall Exchange 2010 binaries from Server A. Disjoin server from the domain. remove any remnants from ADSIedit if needed.

    Will this be the most graceful way to remove this server from the environment? I want to ensure it is totally seamless to the end users.

    thanks

  23. Tim Baker

    I have migrated all mailboxes and public folders from one Exch2010 server to another. I’ve also confirmed with your commands above. I still can’t remove the original server PF database due to the ‘contains replicas’ error.

    If I dismount that PF database, mail delivery to mail enabled public folders on the new server stop. I was told that would no longer be a problem once I remove the old PF database.

    I can either dismount/rename/delete the old one, or remove it with ADSIedit. But I first wanted to see if you can confirm for me that mail delivery to Public Folders will indeed work again after removing the old server Public Folder database?

    Thank you, you are the Go-To source for Exchange management help.

    1. Paul Cunningham

      I can’t really confirm anything for you because I have no visibility of your environment. I would suggest that you pursue more investigations into the issue preventing you from removing the PF database.

  24. Chris

    Hi Paul,

    (Background info…we’re in a mixed 2010/2013 environment…trying to get rid of all 2010.)

    I would like to COMPETELY remove the Public Folders from our exchange environment. At the moment, if I cntrl+right click on the Outlook Icon (lower right corner of the end user screen), choose Connection status, the last entry in the list is a proxy to one of the remaining 2010 mailbox servers (that was the sole PF hosting machine after migrating from 2003). We’ve since removed every public folder possible, yet I do still see in Outlook (2010) Public Folders: “Favorites” which is empty, and “all public folders” which has that dangling “…newsgroups” folder.

    If I remove the PF dbase using ADSI Edit, will the Outlook Connection status test cease to look for a PF proxy? Will that line just go away? The reason I ask, if I disable the NIC on that EX2010 machine, new users being configured for NEW Outlook profiles hang while syncing data to the new OST…it say’s it’s trying, but it goes nowhere until that NIC is enabled…. then bam-o! down comes the OST info. (no user boxes are on the 2010 machine…it’s slated for the dumpster).

    Will just uninstalling Exchange 2010 from that server remove all references to PF, never for Outlook to think about again?

    Thanks,
    Chris

  25. Milton Lopez

    Are there any references in AD to Public Folder databases that need to be manually cleaned up after deleting the database object itself (other than the references to it in the msExchHomePublicMDB attribute of mailbox databases, that is)?

    1. Harry

      not sure what I did was right way of doing to fix the issue, after using MS guides to migrate public folders from 2010 to 2013, pubilc folders were working fine on 2013 and I can access these fine,
      but when i go via 2010 public folder console on exchange server it was still showing me all folders there as well, so what i did is deleted all folders that were showing on 2010 console, and then tried deleting public folder database ,
      now public folder database is deleted and i got public folders working on 2013.

      seems all working ok. anyway its on my test bed and i will implement on live servers next week.

  26. Harry

    Hi Paul am running below
    .MoveAllReplicas.ps1 -Server dbsex1 -NewServer dbs-ex1

    below is what i gets as an error and its repeated for each public folder. just to mention all my public folders are migrated to exchange 2013 and being accessed from there , and i want to get rid of exchange 2010 server. thanks
    ————————————————

    You must specify a value with the Replicas parameter.
    + CategoryInfo : InvalidOperation: (NON_IPM_SUBTRE…YDIBOHF23SPDLT):PublicFolderIdParameter) [], SetRep
    licasEmptyException
    + FullyQualifiedErrorId : A21C6F7F

  27. Harry

    Hi Paul when try to run “MoveAllReplicas.ps1” i gets following error

    You must specify a value with the replicas parameter.

    and replicas not being moved to new server hence old wont let me delete publicfolders database .

    any idea about above error.
    thanks Harry

  28. Jaouad

    Thank you so much for the ADSI.EDIT trick, it’s saved my second day.
    have a good day (Jazaka ALLAH alfa khayr)

  29. Tvuil

    My workaround:
    – Dismounted the public folder database
    – Renamed/moved its files (ebd+log)
    – Mounted the database and said “yes” to the recreate warning
    -Delete Public Folder Database

    Test ok with exchange 2010 and 2012

    1. Paul

      I tried Tvuil’s suggestion as I really don’t want to be messing with Active Directory directly as soon as I did this and tried to delete it claimed it had replicas.

      Weirdly in powershell all it displays when I do Get-PublicFolder -Recurse | ft name,parentpath,replicas is IPM_SUBtree line.

      On dismounted the newly created public folder and running the exact same command then all the correct public folders show.

      Any ideas would be greatly appreciated as I need to get this server decommissioned asap.

    2. Nigel Harvey

      Cracking solution Tvuil – I had a stand alone PF generated so we could do a selective data restore and once done couldn’t get rid of it because Exchange 2010 had already decided it would replicate to existing PF databases despite other settings.

      Was looking at ADSIEdit but gave your solution a shot first – result! – legal removal of a dead database.

      Many thanks again 🙂

    3. Louis Reedijk

      EPIC working like a charm 🙂 we moved completely to office365, so there was no need to keep anything. But I would like a clean un-install of Exchange 🙂

    4. John

      Excellent solution!!

  30. vadim

    BTW, after spending hours on this (we have literally hundreds of PF), running scripts and then verifying all of it through the GUI I still would get the same error stating there are some replicas on DB. Could not find any in any way, so finally resorted to ADSI. Still waiting for some possible issues/error to appear. In Auto industry they used to call products like that a ‘lemon’. Seems not anymore – I guess they took it after IT industry where its simply a norm :-).

  31. vadim

    Helpful, as always, not exhaustive, though (also, as always :-)). At least in certain cases (if not all) search for replicas might not show all the replicas existing. Running full search script is almost impossible to read if you have a lot of PFs on more than three servers (the line of PBs names is extending beyond the PS windows and is not wrapping). That one indeed is more convenient in this case: Get-PublicFolder -Recurse -ResultSize Unlimited | where {$_.replicas -like “*server01*”}.

    But neither will show replicas of Offline Address Book or Free/busy schedules, for instance. Luckily it can be seen and taken care of from the GUI of PF management console. You can easily see those replicas and remove replication there even when PS search script above does not show any replicas left. (Maybe these scripts don’t search System Folders at all).
    On the side note this PF affair is another sloppy bug causing inordinate efforts to perform what should be (and was in the past) a basic task.

  32. Sid

    This is the graceful solution I was looking for.
    Thanks a lot.

  33. Crue

    You can use “[PS] C:\>cd $exscripts” to get to the Exchange Scripts folder as well.

  34. Phil Ready

    How can I set an email address policy for Mail Enabled Public Folders in Exchange 2013? The EAC only seems to apply to Mailboxes and want me to set it by OU.
    I am guessing in the shell I can use set-mailpublicfolder
    Thanks
    Phil

  35. Kent

    I’ve migrated what I think is everything from Exchange 2010 -> Exchange 2013. It still says there are replicas on the Exchange 2010 server. How can I be absolutely sure that everything is now on the 2013 server before I decommission the 2010 server? Thanks!

  36. Jeff

    Great info here. I went through and followed it very well…At least I thought I did. I get this error when running the search script.

    No existing ‘PublicFolder’ matches the following Identity: ”. Make sure that you specified the correct ‘PublicFolder’
    Identity and that you have the necessary permissions to view ‘PublicFolder’.
    + CategoryInfo : NotSpecified: (0:Int32) [Get-PublicFolder], MapiOperationException
    + FullyQualifiedErrorId : F093BF67,Microsoft.Exchange.Management.MapiTasks.GetPublicFolder

    I also cannot view the exchnage server through ADSI Edit.

    Any help would be well appreciated.

    Jeff

  37. Brian

    Great information in this post!!! Really on point.

    Thanks!

  38. Kottees

    Paul,

    I’ve changed the OAB generation server from PF1 (2010) server to PF2 (2010). But couldn’t change the OAB Public Folder Database. It is still pointing to the old one, PF1 database still exist.

    If I take PF01 offline will it pick it automatically or can we do it through adsiedit.

    1. Paul Cunningham

      Do you still need to publish your OAB to public folders? It is only needed for Outlook 2003 clients.

      1. Kottees

        No Paul, we don’t have 2003 clients anymore. I believe i’m good to go ahead and remove it.

  39. Khai

    Another note ran EXBPA and getting this error “The site-wide public folder database for administrative group ‘Exchange Administrative Group (FYDIBOHF23SPDLT)’ has been deleted” did I really mess things up?

    1. Khai

      I cleared the “siteFolderServer” attribute on CN=Exchange Administrative Group (FYDIBOHF23SPDLT) to clear the error in EXBPA

  40. Khai

    Hi Paul – After manually deleting the Public Folder database from adsiedit

    Getting Event ID 3043 logged with the following message

    Error 0x972 occurred while performing a site folder check for public folder store “Public Folder Database 1486425264”

    Any ideas??

  41. Ahmed Kilic

    hello Paul, thanks for the article. I deleted Public Folder Database with your explanation from ADSIEDIT. but I think when I deleted Public Folder DB it was Mounted state. and now I can’t add a new Public Folder Databse. I get this error:
    Event: 9677
    Public Folder Database “Name” cannot be mounted because there is another public folder database from the same public folder tree already mounted. Erroro – 80004005
    How can i parmanently delete old Public Folder

    1. Gary

      I had this problem too. Bugged me for ages. Resolution was to restart the Information Store!

      1. Gabriele

        After restarted the Information Store I was able to create new PF.
        Many thanx

  42. Richard Chan

    Greeting Paul, I’ve bookmarked all your articles and feel all your articles are very helpful to all of us. However, I do need some advice about removing a Public Folder from a 4 mailboxes DAG. Scenario is that one of the mailboxes didn’t have a Public Folder configured, so I’ve tried to configure it like I did the others. To my surprise, the Public Folder was created and not mounted. It mentioned something about the mailbox id. So the “created” Public Folder is showing as Dismounted. I logged into the server that the Public Folder didn’t mount and found that there were path to two different mailboxes. I didn’t know that when I tried to create the Public Folder, so it was attempting to create the Public Folder on the mailbox that was no longer used. I tried to remove the Public Folder from the EMC but got the error message “Exchange isn’t able to check for public folder replicas for “Public Folder XXXX” Verify that the Microsoft Information Store” is running on XXXX. Paul, any suggestion?

  43. Jonby

    Ran into this issue yesterday. This article saved me. Thanks again.

  44. mike

    I think I mad a mistake some where are I have used ADSIEdit to remove the public folder but now one of my mailboxes in in a unknown state this it fresh install so no data in the mailbox but I cannot remove the mailbox and create a clean install

    can anyone help?,

  45. awol

    U ARE THE MAN!!!!
    Spent hours and hours running scripts to try and remove a server that had been offline for months. MS make it rocket science to perform a simple every day task with no “what if” fallback scenarios, like “what if the server cannot replicate anymore?!”

  46. Brett

    Worked for me after much hand ringing before.

  47. dian

    Useful for me thank you

  48. GzBz

    Why not just search for any Public Folder with the specified server as a replica?

    Get-PublicFolder -Recurse -ResultSize Unlimited | where {$_.replicas -like “*server01*”}

    For orgs with a ton of PFs this makes life much easier. Good stuff, thanks

  49. Kevin

    Man… you rock.

    Took me forever to fidn this, but once I did I was finally able to uninstall my broken exchange 2010 installation.

    Thank you!!!!!!!!!!!!!!!!!!! A million Times Thank you

Leave a Reply