Thursday, June 4, 2009

Mass setting replication partners with Public Folders

As you have probally experianced setting replication partners with public folders is a tedious process as you need to do them one by one. However in Exchange 2007 there is a powershell script called AddReplicaToPFRecursive.ps1 under the C:\Program Files\Microsoft\Exchange Server\Scripts that recursively goes through and updates your public folder replication partners for every public folder in a hierarchy that you specify, excellent!

For your default public folders run:

'C:\Program Files\Microsoft\Exchange Server\Scripts\AddReplicaToPFRecursive.ps1' -TopPublicFolder "\" -ServerToAdd Servername

To update your system public folders run:

'C:\Program Files\Microsoft\Exchange Server\Scripts\AddReplicaToPFRecursive.ps1' -TopPublicFolder "\NON_IPM_SUBTREE" -ServerToAdd Servername

Note these commands you will get an error as the very top level folder cannot have replication partners, only the sub folders of a public folder hierarchy! This command is saying start at the parent ahh error, then continue on all the sub folders which will not have a problem! Here is the error that you will recieve - this is normal:



Also one thing to note with this tool, there is a little querk when it comes to spaces when you want to assign ppl at lower levels. Here is an example:

If you simply try to use the following it will fail.
AddReplicatoPFRecursive.ps1 -TopPublicFolder “\PublicFolder with space” -ServerToAdd “servername”

The solution turned out to be to use single quotes inside the double quotes so it should be something like

AddReplicatoPFRecursive.ps1 -TopPublicFolder “’\PublicFolder with space’” -ServerToAdd “servername”

That’s really weird and not standard but it works.

This tool can be used for public folders between exchange 2003 and 2007 as well.

4 comments:

  1. Thanks. This is the ONLY information on the internet regarding adding a replica for the system folders.

    ReplyDelete
  2. Thanks I searched for about 2 hours to find your blog and the only good information.

    ReplyDelete
  3. Thanks - helpful article.

    ReplyDelete
  4. I have been researching for hours and tried the script on this page; however, I am unable to come up with any reason why I keep getting the following error:

    Set-PublicFolder : Cannot save the object '\NON_IPM_SUBTREE\SCHEDULE+ FREE BUSY'. Please make sure that you specified the correct Identity and that you have the necessary permissions to save it.

    It doesn't matter if I try it from exchange management console Public Folder Management tool or through the shell using this script.

    Any Suggestions?

    ReplyDelete