Use the MoveAllReplicas.ps1 script to move all public folder content from one server to another server
To move all public folders in a public folder database on one server to a public folder database on another server, use the MoveAllReplicas.ps1 script. This script replaces a server with a new server in the replication list for all public folders, including system folders. For more information about using public folder scripts, see Scripts for Managing Public Folders in the Exchange Management Shell.
This example moves all public folder content from Server01 to Server02.
cd $EXscripts
.\MoveAllReplicas.ps1 -Server Server01 -NewServer Server02
If you are move from Exchange 2007 to Exchange 2010, you had better run the scripts from Exchange 2010 servers.
However, I would prefer you run the following script first, and make sure all public folders including system folders are replicated to new server first,
1. run Get-PublicFolder -Server OldPFServername -Recurse | FL Name,Replicas
If there is any issue, fix it first, say, some of old PF folders may contain leading or trialing whitespace that no longer support in new Exchange server.
WARNING: The Name property
contains leading or trailing whitespace, which must be removed.
2. use AddReplicaToPFRecursive.ps1 to replicate all Folders to new server
[PS] C:\Program Files\Microsoft\Exchange Server\V14\Scripts>.\AddReplicaToPFRecursive.ps1
AddReplicaToPFRecursive.ps1 -Server "MyEx2007Server" -TopPublicFolder "\" -ServerToAdd "MyEx2010Server"
3.\AddReplicaToPFRecursive.ps1 -Server "MyEx2007Server" -TopPublicFolder "\NON_IPM_Subtree" -ServerToAdd "MyEx2010Server"
The above command will add replica of all public folders to exchange 2010 public folder database.
Once the replica is added you can move the replica from Exchange 2007 to Exchange 2010. To do this execute the below EMS command:
4. .\MoveAllReplicas.ps1 -Server "MyEx2007Server" -NewServer "MyEx2010Server"