This is a fairly common question — you’re trying to remove the Public Folder store on an Exchange 2007 server and get an error that some Public Folder replicas still exist. You’re certain you’ve removed all Public Folder replicas from that server. What next?
Here’s a little procedure documented in How to Delete Multiple Public Folders from Your Organization that takes care of this.
Note: You should perform this procedure only if you’re removing the last (or only) Public Folder Store from an Exchange Organization. If there are other servers in the Organization that also host Public Folders, using this procedure removes the folders from the Public Folder hierarchy.
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
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
To verify all Public Folders have been deleted:
Get-PublicFolderStatistics -Server “SERVER NAME” | fl
At times the replica clean-up may take a little while. If you still see replicas after running this command, run it again in 10-15 minutes.
Removing Public Folder replicas using MoveAllReplicas.ps1
If Public Folders are hosted on more than one server, use the MoveAllReplicas.ps1 script to remove replicas from a server, as illustrated in KB 927464: How to remove Exchange 2007 from a computer.
The MoveAllReplicas.ps1 script resides in the \Scripts folder in the path where Exchange Server 2007 is installed. It’s an easy-to-use script that takes 2 parameters — the source and target server names. The source server is the server you’re trying to remove the Public Folder replicas from. The target server can be any other server in the Organization that hosts Public Folders — presumably a server that’s in the same location (AD Site) to avoid replicating PFs over WAN links.
MoveAllReplicas.ps1 -Server “SOURCE SERVER NAME” –NewServer “TARGET SERVER NAME”
Once this is done, it may take some time for Public Folders to replicate to the target server, and for these to be removed from the source server. To verify there are no replicas on the source server, you can use the Get-PublicFolderStatistics command.
{ 11 comments… read them below or add one }
Thank you very much!! After much frustration, this solved my problem!! Namaste!
I have a similar issue. We have two Exchange servers. Both have Public Folders. I have to decommission one server. I have suspended the replication and applied the move all replicas script from the server that is leaving.
I have pointed the mailbox from First Storage to point to the Public Folder database of the server that is staying. I also pointed it on the server that is not staying.
I need to uninstall the server, but the mailbox role will not uninstall until I clear the replicas.
After applying the scrip a day ago, there are some replicas still in the old server thus the uninstallation is not possible. What can I do now?
Any help would be appreciate it.
Please move the note that says to only do this if this is the only PF store to be BEFORE the powershell commands to use Remove-PublicFolder.
I’m currently on a support call with a customer who had someone that was trying to remove a 2007 Mailbox server most likely do this in their environment and deleted the whole PF tree. We’re now in the process of trying to recover folders.
@Richard: Thanks for pointing out. The note has been moved before the procedure.
Does the “Remove” delete the instance from only the server you apply this to? Or does it try to delete it from all servers.
I ask because some of the wording in E2k7 means something different. Like Remove when right clicking a mailbox. (it deletes the user, too.)
i have a CCR that had a PF database installed at setup. I want to remove it but there are system folders on it. no one is on the 2k7 boxes yet.
@Darwin: As noted in the post—
If there are other servers in the Organization that also host Public Folders, using this procedure removes the folders from the Public Folder hierarchy."
Hi, I made the exact same mistake as Richard in the above post describing. Needed to remove from one server, but wiped out the whole hierarchy on all servers. We’ve run a restore, and replication deleted it again. We set the replication on all stores to “never run”, but after about 12 hours, it deleted it again. Anyone got a good idea?
Thanks
ok,
im in a migration from exchange 2007 to exchange 2007 server, i used the MoveAllReplicas.ps1 and all folders are on the new server. but how to go on now? which steps do i have to take to remove the old public folder database without removing files on the new server?
tnx in advanxce.
greetz styler
I'm in the same boat – I followed this script on another page and was not aware this would wipe out the entire Public Folder hierarchy.
does anyone know how to un-do what this command does? We are running Exchange 2003 as our primary server and have lost the Public Folders in Exchange. The database files are still there, but there's nothing showing up in Exchange System Manager or Outlook
Please let me know if you have any ideas on this – I'm awaiting a call back from Microsoft at the moment, but it will be several hours before I hear back
Nick
Hi, we have a exchange 2007 setup and wanted to remove some of the public folders.
But before doing this , we would like to archive the mails which will be availble to users for use.
Please help me to find the solution
THANK YOU for this article. I have an ancient domain from W2K to W2K8R2 that has hosted Exchange 2000 to 2010 and I could not for the life of me remove the left over Public Folder garbage that has leeched onto my installation. PF was never used and will never be used in this organization. The reason for wanting to remove it is because the OAB was trashed beyond repair. Clients were not updating properly. GAL photo implementation failed because clients would have to delete the existing user then re-add that user to get the photo. What a mess!
Now that the PF garbage is gone and a new OAB has been created, everyone is updating smoothly. Thanks again!!!