HOW TO: Remove the Public Folder Store

by Bharat Suneja on May 5, 2008

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.

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

3 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 }

Leave a Comment

Previous post:

Next post: