Thursday, September 29, 2011

Exchange 2007 and 2010 Public Folder Oddities

Was working with migrating an Exchange 2007 environment up to Exchange 2010, and ran into some strange issues with Public Folders (don't they always have the fun problems?).  For this migration I was going to add a replica to the 2010 server and then once the mailboxes were migrated remove the replica from the old server.  Seems simple enough, right?

If you go to the Public Folder Management Console on the 2007 server, you can easily go to the properties of a folder and add the replica right there.  That seems pretty easy, and for a small environment it certainly is.  However when you need to migrate hundreds of folders, that's not practical.  You might think "well i can just pipe a few powershell commands together and get it added" and you are right.

However, there is a handy script that is bundled with Exchange 2007/2010 in the Scripts directory (in the Program Files directory for Exchange) called AddReplicaToPFRecursive.ps1.  This is supposed to go through every public folder and add the new server to the list of replicas so it will replicate.

Here is what they expect you to run on the 2007 server (for all examples, EX2010 and EX2007 refer to your Exchange 2010 and 2007 servers respectively):

> .\AddReplicaToPFRecursive.ps1 -TopPublicFolder "\" -ServerToAdd EX2010

This command will run and probably not give any errors.  However, if you do a quick check you will see that nothing has happened:

> Get-PublicFolder "\Test1" | Select-Object Replicas

Replicas
--------
{EX2007\Second Storage Group\Public Folder Database}

Well clearly that isn't right, where is the 2010 server?  The issue is that it will not error out or give you any indication that you should have actually been running this on the 2010 server, not the 2007 server.  So at this point you need to switch to the 2010 server and run:

> .\AddReplicaToPFRecursive.ps1 -TopPublicFolder "\" -ServerToAdd EX2010 -Server EX2007

Note that there is an extra parameter in here now (which is suspiciously missing from most of Microsoft's examples, as they expect you to run this on the 2007 server).  After running this command if you want instant satisfaction you may want to run Update-PublicFolderHierarchy -Server EX2007, or wait for the replication interval.

Now if you go and look, the folders should start appearing and being replicating items.  You can tell with the original test command:

> Get-PublicFolder "\Test1" | Select-Object Replicas

Replicas
--------
{Public Folder Database 2,EX2007\Second Storage Group\Public Folder Database}

You can also check the current progress for replication with something like this (run on both servers to compare):

> Get-PublicFolderStatistics | Measure-Object -Property ItemCount -Sum

This will show the total items that have been replicated so far (look at the Sum).

No comments:

Post a Comment