Applies to: Exchange Server 2013

Topic Last Modified: 2013-02-26

This topic describes how to migrate your public folders from Exchange Server 2010 SP3 or Exchange 2007 SP3 RU10 to Microsoft Exchange Server 2013. You’ll perform the migration by using the new *PublicFolderMigrationRequest cmdlets, in addition to several PowerShell scripts. These cmdlets use the Microsoft Exchange Mailbox Replication service to perform the migration. The following PowerShell scripts are installed on your computer when you install Exchange 2013 and they can be found in the following location <Exchange Install Path>Program Files\Microsoft\Exchange Server\V15\Scripts.

For additional management tasks related to public folders, see Public Folder Procedures.

This document will refer to the Exchange 2010 SP3 and Exchange 2007 SP3 RU10 servers as the legacy Exchange server.

What do you need to know before you begin?

  • You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Public folders" entry in the Sharing and Collaboration Permissions topic.

  • User mailboxes should be moved to Exchange 2013 before you begin this process.

  • The Exchange 2010 server must be running SP3 or later.

  • The Exchange 2007 server must be running SP3 RU10 or later.

  • You must perform the prerequisite steps listed in this section for both your Exchange 2010 SP3 and Exchange 2013 servers.

  • Before you begin, we recommend that you read this topic in its entirety as downtime is required for some steps.

  • We recommend that you first perform a backup of your public folder databases.

  • For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard Shortcuts in the Exchange Admin Center.

Tip:
Having problems? Ask for help in the Exchange forums. Visit the forums at: Exchange Server, Exchange Online, or Exchange Online Protection

How do you do this?

Step 1: Prepare for the migration

Perform the following prerequisite steps on your legacy Exchange servers.

Prerequisite steps on the legacy Exchange server

  1. For verification purposes at the end of migration, we recommend that you run the following Shell commands on the Exchange 2010 SP3 server to take snapshots of your current public folder deployment.

    • Run the following command to take a snapshot of the original source folder structure.

      Copy Code
      Get-PublicFolder -Recurse | ConvertTo-CSV C:\PFMigration\Ex2010_PFStructure.csv
      
    • Run the following command to take a snapshot of the public folder statistics such as item count, size, and owner.

      Copy Code
      Get-PublicFolder -Recurse | Get-PublicFolderStatistics | ConvertTo-CSV C:\PFMigration\Ex2010_PFStatistics.csv
      
    • Run the following command to take a snapshot of the permissions.

      Copy Code
      Get-PublicFolder -GetChildren | Get-PublicFolderClientPermission | Select-Object Identity,User -ExpandProperty AccessRights | ConvertTo-CSV C:\PFMigration\Ex2010_PFPerms.csv
      
    Save the information from the above commands for comparison at the end of the migration.

  2. On the legacy Exchange server, make sure there isn’t a previous record of a successful migration. If there is, you’ll need to set that value to $false. If the value is set to $true the migration request will fail.

    The following example checks the public folder migration status.

    Copy Code
    Get-OrganizationConfig | Format-List PublicFoldersLockedforMigration, PublicFolderMigrationComplete
    
    If the status of the PublicFoldersLockedforMigration or the PublicFolderMigrationComplete property is $true, run the following command to set the value to $false.

    Copy Code
    Set-OrganizationConfig -PublicFoldersLockedforMigration:$false -PublicFolderMigrationComplete:$false
    
    Warning:
    After resetting the above properties, you’ll need to wait for Exchange to detect the new settings. This may take several minutes. To expedite the process, you can restart the Microsoft Exchange Information Store service by running the following command: Restart-Service MSExchangeIS.

For detailed syntax and parameter information, see the following topics:

Prerequisite steps on the Exchange 2013 server

  1. Make sure there are no existing public folder migration requests. If there are, clear them. This step is a prerequisite and isn’t required in all cases. It’s only required if you think there may be an existing migration request in the pipeline. In any case, the following command below won’t affect the new migration. The following example removes any existing public folder migration requests.

    Copy Code
    Get-PublicFolderMigrationRequest | Remove-PublicFolderMigrationRequest -Confirm:$false
    
  2. To make sure there are no existing public folders on the Exchange 2013 servers, run the following commands.

    Copy Code
    Get-Mailbox -PublicFolder 
    Get-PublicFolder
    If the above commands return any public folders, use the following commands to remove the public folders.

    Copy Code
    Get-MailPublicFolder | where $_.EntryId -ne $null | Disable-MailPublicFolder -Confirm:$false 
    Get-PublicFolder -GetChildren \ | Remove-PublicFolder -Recurse -Confirm:$false
    Get-Mailbox -PublicFolder |Remove-Mailbox -PublicFolder -Confirm:$false

For detailed syntax and parameter information, see the following topics:

Step 2: Generate the CSV files

  1. On the legacy Exchange server, run the Export-PublicFolderStatistics.ps1 script to create the folder name-to-folder size mapping file. The file will contain two columns: FolderName and FolderSize. The values for the FolderSize column will be in displayed bytes. For example, \PublicFolder01,10000.

    Copy Code
    .\Export-PublicFolderStatistics.ps1 <FQDN of source server> <Folder to size map path>
    
    • FQDN of source server equals the fully qualified domain name of the Mailbox server where the public folder hierarchy is hosted.

    • Folder to size map path equals the file name and path on a network shared folder where you want the CSV file saved. You’ll need to access this file from the Exchange 2013 server. If you specify only the file name, the file will be generated in its current location.

  2. Run the PublicFolderToMailboxMapGenerator.ps1 script to create the public folder-to-mailbox mapping file. This file is used to create the correct number of public folder mailboxes on the Exchange 2013 Mailbox server.

    Note:
    If the name of a public folder contains a backslash \, the public folders will be created in the parent public folder. We recommend that you review the csv file and edit any names that contain the backslash.
    Copy Code
    .\PublicFolderToMailboxMapGenerator.ps1 <Maximum mailbox size in bytes> <Folder to size map path> <Folder to mailbox map path>
    
    • Maximum mailbox size in bytes equals the maximum size you want to set for the new public folder mailboxes.

      Note:
      When specifying this setting, be sure to allow for expansion so the public folder mailbox has room to grow.
    • Folder to size map path equals the file path of the CSV file you created when running the Export-PublicFolderStatistics.ps1 script.

    • Folder To mailbox map path equals the file name and path of the folder-to-mailbox csv file that you’ll create with this step. If you specify only the file name, the file will be generated in its current location.

Step 3: Create the public folder mailboxes on the Exchange 2013 server

Warning:
The name of the public folder mailboxes that you create must match the name of the TargetMailbox in the mapping file. You can edit the TargetMailbox names in the mapping file to match your organization’s naming conventions.
  1. Run the following command to create the first public folder mailbox on the Exchange 2013 Mailbox server. Public folder mailboxes contain the hierarchy information for a public folder, whereas the public folder contains the actual content. The first public folder mailbox that you create will be the master hierarchy mailbox. You need to create the first public folder mailbox in HoldForMigration mode.

    Copy Code
    New-Mailbox -PublicFolder <Name> -HoldForMigration
    
  2. Run the following command to create additional public folder mailboxes as needed based on the script output from the PublicFoldertoMailboxMapGenerator.ps1 script.

    Copy Code
    New-Mailbox -PublicFolder <Name>
    
    If you need to create several public folder mailboxes, you can write a script help automate the process. This example creates 10 public folder mailboxes.

    Copy Code
    $numberOfMailboxes = 10; 
    for($index =0 ; $index -lt $numberOfMailboxes ; $index++)
    {
    $PFMailboxName = "Mailbox"+$index;
    if($index -eq 0)
    {
    New-Mailbox -PublicFolder $PFMailboxName -HoldForMigration;
    }
    else
    {
    New-Mailbox -PublicFolder $PFMailboxName;
    }
    }

For detailed syntax and parameter information, see New-Mailbox.

Step 4: Start the migration request

  1. From the Exchange 2013 Mailbox server, run the following command:

    Copy Code
    New-PublicFolderMigrationRequest -SourceDatabase (Get-PublicFolderDatabase -Server <Source server name>) -CSVData (Get-Content <Folder to mailbox map path> -Encoding Byte)
    
  2. To verify that the migration has started successfully, run the following command.

    Copy Code
    Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics -IncludeReport | Format-List
    
    You’ll know that the command has started successfully when the migration request reaches a status of Queued or InProgress. Depending on how much data is contained in the public folders, this command can take a long time to complete. If migration isn’t being throttled due to the load on the destination server, the typical data copy rate can be 2 GB to 3 GB per hour.

  3. When the status of the migration request reaches a status of AutoSuspended, you can move to Step 4.

For detailed syntax and parameter information, see the following topics:

Step 5: Lock down the public folders on the legacy Exchange server for final migration (downtime required)

Warning:
The amount of downtime required depends on how much new content was generated since the migration reached the AutoSuspended state.

Until this point, users have been able to access public folders during the migration. The next steps will log users off from the public folders and lock the folders while the migration completes its final synchronization. Users won’t be able to access public folders during this process.

Run the following command on a legacy Exchange server.

Copy Code
Set-OrganizationConfig -PublicFoldersLockedForMigration:$true

For detailed syntax and parameter information, see Set-OrganizationConfig.

If your organization has multiple public folder databases, you’ll need to wait until public folder replication is complete to confirm that all public folder databases have picked up the PublicFoldersLockedForMigration flag. If you want to bypass this waiting period, you can restart the Microsoft Exchange Information Store service by running the following command:

Copy Code
Restart-Service MSExchangeIS

Step 6: Test the public folder migration

Before you finalize the public folder migration, you should run the following test to ensure that the public folder migration was successful. This will allow you to test the migrated public folder hierarchy before you switch the entire Exchange organization to use the Exchange 2013 public folders.

  1. Manually set the PublicFolderMigrationComplete property to $true by running the following command:

    Copy Code
    Set-OrganizationConfig -PublicFolderMigrationComplete:$true
    
  2. Exclude the public folder mailbox from the serving hierarchy so that email won’t be delivered to Exchange 2013 mail-enabled public folders during this test.

    Copy Code
    Set-Mailbox -Identity <Public Folder Mailbox Identity> -PublicFolder -IsExcludedFromServingHierarchy $true
    
  3. Assign some test mailboxes to use the public folder mailbox in the previous step as the default public folder mailbox.

    Copy Code
    Set-Mailbox -Identity <Test User> -DefaultPublicFolderMailbox <Public Folder Mailbox Identity>
    

Step 7: Finalize the public folder migration (downtime required)

By default, when you run the Set-PublicFolderMigrationRequest cmdlet, it won’t complete until you remove the PreventCompletion flag and resume the migration request.

Copy Code
Set-PublicFolderMigrationRequest -Identity \PublicFolderMigration -PreventCompletion:$false
Resume-PublicFolderMigrationRequest -Identity \PublicFolderMigration

For detailed syntax and parameter information, see Set-PublicFolderMigrationRequest and Resume-PublicFolderMigrationRequest.

Step 8: Remove public folder database from the legacy Exchange servers

Once the process is completed and you have verified that the Exchange 2013 public folders are working as expected, you should remove the public folder databases on the legacy Exchange servers.

How do I know this worked?

In Step 1 of this topic, you were instructed to take snapshots of the public folder structure, statistics, and permissions before migration began. The following steps will help verify that your public folder migration was successful by taking the same snapshots after the migration is complete. You can then compare the data in both files to verify success.

  1. Run the following command to take a snapshot of the destination public folder structure.

    Copy Code
    Get-PublicFolder -Recurse | ConvertTo-CSV > C:\PFMigration\Ex2013_PFStructure.csv
    
  2. Run the following command to take a snapshot of the public folder statistics.

    Copy Code
    Get-PublicFolder -Recurse | Get-PublicFolderStatistics | ConvertTo-CSV > C:\PFMigration\Ex2013_PFStatistics.csv
    
  3. Run the following command to take a snapshot of the permissions.

    Copy Code
    Get-PublicFolder -GetChildren | Get-PublicFolderClientPermission | Select-Object Identity,User -ExpandProperty AccessRights | ConvertTo-CSV > C:\PFMigration\Ex2013_PFPerms.csv
    

Roll back the migration

If you run into issues with the migration and need to reactivate your Exchange 2010 public folders, perform the following steps:

Warning:
After the migration is complete, any changes you made to your Exchange 2013 public folders won’t be reflected in the legacy Exchange. As a result, you may lose public folder data if you roll back the migration. In addition, as part of the rollback, we recommend that you remove any Exchange 2013 public folders that were created as part of the migration process. To remove the public folders, follow the Exchange 2013 prerequisite steps listed in Step 1: Prepare for the migration earlier in this topic.
  1. To unlock legacy Exchange public folders, run the following command on the legacy Exchange server.

    Copy Code
    Set-OrganizationConfig -PublicFoldersLockedForMigration:$False
    
  2. To set the PublicFolderMigrationComplete flag to $false, run the following command on the Exchange 2010 SP3 server:

    Copy Code
    Set-OrganizationConfig -PublicFolderMigrationComplete:$False