Useful commands for managing public folders

In recent days I fought a lot in trying to properly fix public folder replicas (probably the worst managed service run by exchange) so I decided to write an article with the commands that have been helpful to me to configure, check and force replication of the public folder.

After Exchange 2013 public folder migration should be more manageable because PF are contained in mailboxes but, at the moment, public folders are one of the most awkward service to migrate mainly because comfortable tools are not provided to handle and monitor their status.

Premise: commands / scripts with .ps1 extension that you found below are available in the exchange installation folder “C:\Program Files\microsoft\Exchange\V14\Scripts” for 2010 version or “C:\Program Files\microsoft\Exchange\V15\Scripts” for the 2013 version.

Let's start with the first command:

  • .\ReplaceReplicaOnPFRecursive.ps1 -TopPublicFolder “\Public Folder Name” -ServerToAdd NewServerName -ServerToRemove OldServerName

This command permits, in a single step, to add a new replica server to a public folder and at the same time to eliminate another one. The command is applied to the specified public folder and recursively to all the public folder contained in it. Note that if the server to be removed “OldServerName” is not present in the replica server the command does not run on that single pf. As the name of the public folder you can also specify the root “\”.


  • .\MoveAllReplicas.ps1 -Server OldServerName -NewServer NewServerName

This is the command you would normally launch at the end of a migration of public folder to make sure to eliminate all public folder on the old server that you want to delete; the command runs on all public folder replication servers adding the NewServerName from each replication and removing the OldServerName.


  • Get-PublicFolder \ -Recurse | ft name,parentpath,replicas

This simple command is convenient to have a complete list of all the public folder to see if there are any discrepancies in the replica server configured.


  • .\AddReplicaToPFRecursive.ps1 -TopPublicFolder “\Public Folder Name” -ServerToAdd NewServerName

With this command you can add a replica server to a public folder and its sub public folders recursively. As the name of the public folder you can also specify the root “\”.


  • Get-PublicFolderStatistics -result unlimited | ft AdminDisplayName, ItemCount, FolderPath

Useful command to get the number of items in a public folder, if you want you can export the results to a .csv file in order to compare the results of the command applied to multiple replication servers to see if indeed all the elements have been replicated.


  • Get-PublicFolder -recurse | Update-PublicFolder -server SourceServerName

Useful command to recursively force replication of all public folder using SourceServerName as reference server.


  • Update-PublicFolderHierarchy -Server “Servername”

Another command to force replication between two servers that are not perfectly synchronized

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.