Monday, August 1, 2011

Move Public Folders All replica to Exchange 2010 Server PS Script

If you are in the middle of migration and it is time to move all PF folder replicas from Exchange 2007 to Exchange 2010 server PS is your friend.

Lets say your Existing Exchange 2007 Server name is EXC07 and you want to move all PF replicas to newly build Exchange 2010 Server called EXC210 , you can use fallowing PS commands…..

Connect to your Exchange Server , open EMS


Navigate fallowing directory from PS command line

[PS] E:\Program Files\Microsoft\Exchange Server\V14\Scripts>

  • AddReplicaToPFRecursive.ps1
  • RemoveReplicaFromPFRecursive.ps1
  • ReplaceReplicaOnPFRecursive.ps1
  • MoveAllReplicas.ps1


Now we are ready to execute existing scripts sits on this directory. All PF replicas sits on the server called “EXC07” and I like to add Exchange 2010 Server called “EXC210 into PF replica  folders as second server.


.\AddReplicaToPFRecursive.ps1 –Server EXC210 –TopPublicFolder \ –ServerToAdd “EXC07”


Remove Replica  ( pay attention  Exchange  server must have all of its public folder replicas removed before it can be decommissioned…. )

.\RemoveReplicaToPFRecursive.ps1 –Server EXC210 –TopPublicFolder \ –ServerToRemove “EXC07”
  • Now System folders
.\AddReplicaToPFRecursive.ps1 -TopPublicFolder "\NON_IPM_Subtree" ServerToAdd


  • To view a list of the replicas in the public folder hierarchy
Get-PublicFolder -recurse |fl name,replicas
  • Move all replicas from EXCH07 to EXC210

MoveAllReplicas.ps1 –Server EXC07 –NewServer EXC210

  • For System Folders
Get-PublicFolder -recurse \non_ipm_subtree |fl name, replicas
  • To compare content replicated between the source and destination servers
Get-PublicFolderStatistics | FL
  • Also
Get-PublicFolderStatistics –Server ServerA
  • Compare Output to ServerB
Get-PublicFolderStatistics –Server ServerA



Oz Casey, Dedeal ( MVP north America)
MCSE 2003, M+, S+, MCDST
Security+, Project +, Server + (Blog) (Blog


VA's RHD Hachi Roku said...

Oz I have a question! Have you seen issue where PF folders have invalid characters such as a white space at the end fail to move?

Also we did clean up and it took a long time to fix all the issue with 190k folders. After fixing them we realized that Outlook doesn't enforce the same restrictions when using emc or ems to create and manage PF's. Users have been messing up all the admins hard work ={

Oz Casey Dedeal said...

Shay Levy has the PS to do the work,Check this out in regards to white space and invalid characters , removing them from PF folders

get-publicfolder -identity "\" -Recurse -ResultSize Unlimited | Foreach { Set-publicfolder -Identity $_.Identity -Name ($_.Name -replace ",|\s") }

Not sure if you can test it but give it a try

Windows Auditing said...

Hello friends,

Before you configure replication settings, you must first create public folder stores on the servers to which you want to replicate. Associate those stores with the public folder tree that contains the folder that you want to replicate. Thanks for sharing it......

Active Directory Group Membership said...

Hi all,

Ensuring that your servers are operating reliably and that your mailbox database copies are healthy and primary objectives of daily Exchange 2010 messaging operations. Thanks a lot......

Anonymous said...

Isnt this backwards?

.\AddReplicaToPFRecursive.ps1 –Server EXC210 –TopPublicFolder \ –ServerToAdd “EXC07”

Anonymous said...

Yeah, it should read .\AddReplicaToPFRecursive.ps1 –TopPublicFolder \ –ServerToAdd “EXC10”

Anonymous said...

Yes, the AddReplicaToPFRecursive command in the step above is incorrect as highlighted in

Anonymous said...

Thank you for your effort. Would you pls check all scripts and correct them e. g.:
From .\RemoveReplicaToPFRecursive.ps1 to .\RemoveReplicaFromPFRecursive.ps1

Stuart Meeks said...

Excellent article, needed some modification but got me where I need to be!

SEO Services said...

What needs to be changed is that people need to realize that not every problem can be treated with a prescription. People don’t to doctors for help - they go for prescriptions which they equate with a “cure”.


michel jon said...

Nice article, it explanation that how to move all public folder replicas from Exchange 2007 to Exchange 2010 server by using script. I found the exchange migrator tool form which enables to all and selected public folder replicas from 2007 to 2010 and migrate from any exchange server to Office 365.

james marsh said...

Helpful article, it explained that how to migrate Exchange . I found automated utility from which allows to migrate exchange server to another live exchange server without facing any difficulties. This tool migrate multiple mailboxes from one live Exchange Server to another live Exchange Server, public folder and Office 365.