Migrate public folders from Exchange 2010 to Exchange 2016

 

Estimated time to complete: varies depending on the number of public folders to migrate

Before you decommission your Exchange 2010 servers, you need to migrate your public folders to your Exchange 2016 servers. There are several steps involved in migrating public folders. Before you start, make sure that you understand the process explained below in its entirety.

You can migrate up to 500,000 public folders at a time. If you have more than this, you'll need to create migration batches of less than 500,000 public folders per batch. There are other public folder limits that you should consider, such as a maximum number of public folder mailboxes, a maximum number of public folders per public folder mailbox, and so on. Check out Limits for public folders before you start your migration.

What do you need to know before you begin?

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

  • The Exchange 2010 server needs to be running Exchange 2010 SP3 RU8 or later.

  • The maximum number of public folders that can be migrated to Exchange 2016 in a single migration is 500,000.

  • In Exchange 2016, you need to be a member of the Organization Management role group. For details about how to enable the Organization Management role group, see Manage role groups.

  • In Exchange 2010, you need to be a member of the Organization Management or Server Management RBAC role groups. For details, see Add Members to a Role Group.

  • Before you migrate, you should consider the Limits for public folders.

  • Before you migrate, move all user mailboxes to Exchange 2016, because users with Exchange 2007 or Exchange 2010 mailboxes will not have access to public folders on Exchange 2016. For details, see Mailbox moves in Exchange 2013.

  • In a multiple-domain environment, mail-enabled public folders will stop working after migration to Exchange 2016 if Exchange is running in a child domain. This is because in Exchange 2016, mail-enabled public folder objects are required to be under the root domain. To resolve this, you need to mail-disable your mail-enabled public folders and then mail-enable them again, which will allow you to move them to the correct domain location.

  • After the migration is complete, if you want external senders to send mail to the migrated mail-enabled public folders, the Anonymous user needs to be granted at least the Create Items permission. If you don't do this, external senders will receive a delivery failure notification and the messages won't be delivered to the migrated mail-enabled public folder. To read more about how to set permissions on the Anonymous user, see Mail-enable or mail-disable a public folder.

  • You must use a single migration batch to migrate all of your public folder data. Exchange allows creating only one migration batch at a time. If you attempt to create more than one migration batch simultaneously, the result will be an error.

  • 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 I do this?

Step 1: Download the migration scripts

  1. Download all scripts and supporting files from Public Folders Migration Scripts.

  2. Save the scripts to the local computer on which you'll be running PowerShell. For example, C:\PFScripts. Make sure all scripts are saved in the same location.

Step 2: Prepare for the migration

Perform the following prerequisite steps before you begin the migration.

Prerequisite steps on the legacy Exchange server

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

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

      Get-PublicFolder -Recurse | Export-CliXML C:\PFMigration\Legacy_PFStructure.xml
      
    • Run the following command to take a snapshot of public folder statistics such as item count, size, and owner:

      Get-PublicFolderStatistics | Export-CliXML C:\PFMigration\Legacy_PFStatistics.xml
      
    • Run the following command to take a snapshot of the permissions:

      Get-PublicFolder -Recurse | Get-PublicFolderClientPermission | Select-Object Identity,User -ExpandProperty AccessRights | Export-CliXML C:\PFMigration\Legacy_PFPerms.xml
      

    Save the information from the preceding commands for comparison purposes after your migration is complete.

  2. If the name of a public folder contains a backslash \, the public folders will be created in the parent public folder when migration occurs. Before you migrate, we recommend that you rename any public folders that have a backslash in the name.

    1. In Exchange 2010, to locate public folders that have a backslash in the name, run the following command:

      Get-PublicFolderStatistics -ResultSize Unlimited | Where {($_.Name -like "*\*") -or ($_.Name -like "*/*") } | Format-List Name, Identity
      
    2. If any public folders are returned, you can rename them by running the following command:

      Set-PublicFolder -Identity <public folder identity> -Name <new public folder name>
      
  3. Make sure there isn't a previous record of a successful migration.

    1. The following example checks the public folder migration status.

      Get-OrganizationConfig | Format-List PublicFoldersLockedforMigration, PublicFolderMigrationComplete
      

      If there has been a previous successful migration, the value of the PublicFoldersLockedforMigration or PublicFolderMigrationComplete properties is $true. Use the command in step 3b to set the value to $false. If the value is set to $true, your migration request will fail.

    2. If the status of the PublicFoldersLockedforMigration or PublicFolderMigrationComplete properties is $true, run the following command to set the value to $false.

      Set-OrganizationConfig -PublicFoldersLockedforMigration:$false -PublicFolderMigrationComplete:$false
      

    Warning

    After resetting these properties, you need to wait for Exchange to detect the new settings. This may take up to two hours to complete.

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

Prerequisite steps on the Exchange 2016 server

  1. Make sure there are no existing public folder migration requests. If there are, clear them or your own migration request will fail. This step isn't required in all cases; it's only required if you think there may be an existing migration request in the pipeline.

    An existing migration request can be one of two types: batch migration or serial migration. The commands for detecting requests for each type and for removing requests of each type are as follows.

    Important

    Before removing a migration request, it is important to understand why there was an existing one. Running the following commands will determine when a previous request was made and help you diagnose any problems that may have occurred. You may need to communicate with other administrators in your organization to determine why the change was made.

    The following example will discover any existing serial migration requests.

    Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics -IncludeReport | Format-List
    

    The following example removes any existing public folder serial migration requests.

    Get-PublicFolderMigrationRequest | Remove-PublicFolderMigrationRequest
    

    The following example will discover any existing batch migration requests.

    $batch = Get-MigrationBatch | ?{$_.MigrationType.ToString() -eq "PublicFolder"}
    

    The following example removes any existing public folder batch migration requests.

    $batch | Remove-MigrationBatch -Confirm:$false
    
  2. Make sure no public folders or public folder mailboxes exist on the Exchange 2016 servers.

    1. Run the following command to see if any public folders mailboxes exist.

      Get-Mailbox -PublicFolder 
      
    2. If the command didn't return any public folder mailboxes, continue to Step 3: Generate the .csv files. If the command returned any public folders, run the following command to see if any public folders exist:

      Get-PublicFolder
      
    3. If you have any public folders, run the following PowerShell commands to remove them. Make sure you've saved any information that was in the public folders.

      Note

      All information contained in the public folders will be permanently deleted when you remove them.

          Get-Mailbox -PublicFolder | Where {$_.IsRootPublicFolderMailbox -eq $false} | Remove-Mailbox -PublicFolder -Force -Confirm:$false
      
          Get-Mailbox -PublicFolder | Remove-Mailbox -PublicFolder -Force -Confirm:$false
      

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

Step 3: 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. This script needs to be run by a local administrator. The file will contain two columns: FolderName and FolderSize. The values for the FolderSize column will be displayed in bytes. For example, \PublicFolder01,10000.

    .\Export-PublicFolderStatistics.ps1  <Folder to size map path> <FQDN of source server>
    
    • 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. Later in this topic, you'll need to access this file from the Exchange 2016 server. If you specify only the file name, the file will be generated in the current PowerShell directory on the local computer.

  2. Run the PublicFolderToMailboxMapGenerator.ps1 script to create the public folder-to-mailbox mapping file. This file is used to calculate the correct number of public folder mailboxes on the Exchange 2016 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 a backslash.

    .\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. 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 the current PowerShell directory on the local computer.

Step 4: Create the public folder mailboxes in Exchange 2016

  1. Run the following command to create the target public folder mailboxes. The script will create a target mailbox for each mailbox in the .csv file that you generated previously in Step 3, by running the PublicFoldertoMailboxMapGenerator.ps1 script.

    .\Create-PublicFolderMailboxesForMigration.ps1 -FolderMappingCsv Mapping.csv -EstimatedNumberOfConcurrentUsers:<estimate>
    

    Mapping.csv is the file generated by the PublicFoldertoMailboxMapGenerator.ps1 script in Step 3. The estimated number of simultaneous user connections browsing a public folder hierarchy is usually less than the total number of users in an organization.

Step 5: Start the migration request

Once batch migration requests are created with the appropriate cmdlet, you can then view the requests and manage them in the EAC.

Migrate Exchange 2010 public folders

  1. On the Exchange 2016 server, run the following command.

    New-MigrationBatch -Name PFMigration -SourcePublicFolderDatabase (Get-PublicFolderDatabase -Server <Source server name>) -CSVData (Get-Content <Folder to mailbox map path> -Encoding Byte) -NotificationEmails <email addresses for migration notifications> 
    

    The NotificationEmails parameter is optional.

  2. Start the migration using the following command:

    Start-MigrationBatch PFMigration
    

    Or:

    You can start the migration in the EAC.

    1. Log into Exchange Online and open the EAC.

    2. Navigate to Recipients > Migration.

    3. Select the migration batch you just created, and then click the start button.

The Status column will show the initial batch status as Created. The status changes to Syncing during migration. When the migration request is complete, the status will be Synced. You can double-click a batch to view the status of individual mailboxes within the batch. Mailbox jobs begin with a status of Queued. When the job begins the status is Syncing, and once InitialSync is complete, the status will show Synced.

The progress and completion of the migration can be viewed and managed in the EAC. Because the New-MigrationBatch cmdlet initiates a mailbox migration request for each public folder mailbox, you can view the status of these requests using the mailbox migration page. You can get to the mailbox migration page, and create migration reports that can be emailed to you, by doing the following:

  1. Log into Exchange Online and open the EAC.

  2. Navigate to Mailbox > Migration.

  3. Select the migration request that was just created and then click View Details in the Details pane.

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

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

Until this point in the migration, users have been able to access public folders. The next steps will log users off from the legacy 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. Also, any mail sent to mail-enabled public folders will be queued and won't be delivered until the public folder migration is complete.

Before you run the PublicFoldersLockedForMigration command as described below, make sure that all jobs are in the Synced state. You can do this by running the Get-PublicFolderMailboxMigrationRequest command. Continue with this step only after you've verified that all jobs are in the Synced state.

On the legacy Exchange server, run the following command to lock the legacy public folders for finalization.

Set-OrganizationConfig -PublicFoldersLockedForMigration:$true

Note

If for any reason the migration batch file does not finalize (PublicFolderMigrationComplete displays False), on the legacy server, restart the Information Store (IS).

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 and any pending changes users recently made to folders have converged across the organization. This may take several hours.

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

First, run the following cmdlet to change the Exchange 2016 deployment type to Remote:

Set-OrganizationConfig -PublicFoldersEnabled Remote

Once that is done, you can complete the public folder migration by running the following command:

Complete-MigrationBatch PublicFolderMigration

Or, in EAC, you can complete the migration by clicking Complete this migration batch.

When you complete the migration, Exchange will perform a final synchronization between the legacy Exchange server and Exchange 2016. If the final synchronization is successful, the public folders on the Exchange 2016 server will be unlocked and the status of the migration batch will change to Completing, and then Completed. It is common for the migration batch to take a few hours before its status changes from Synced to Completing, at which point the final synchronization will begin.

Step 8: Test and unlock the public folder migration

After you finalize the public folder migration, you should run the following test to make sure that the migration was successful. This allows you to test the migrated public folder hierarchy before you switch to using Exchange 2016 public folders.

  1. In PowerShell, run the following command to assign some test mailboxes to use any newly migrated public folder mailbox as the default public folder mailbox.

    Set-Mailbox -Identity <Test User> -DefaultPublicFolderMailbox <Public Folder Mailbox Identity>
    
  2. Log on to Outlook 2007 or later with the test user identified in the previous step, and then perform the following public folder tests:

    • View the hierarchy.

    • Check permissions.

    • Create and delete public folders.

    • Post content to and delete content from a public folder.

  3. If you run into any issues, see Roll back the migration later in this topic. If the public folder content and hierarchy is acceptable and functions as expected, run the following command to unlock the public folders for all other users.

    Get-Mailbox -PublicFolder | Set-Mailbox -PublicFolder -IsExcludedFromServingHierarchy $false
    

    Important

    Don't use the IsExcludedFromServingHierarchy parameter after initial migration validation is complete as this parameter is used by the automated storage management service for Exchange Online.

  4. On the legacy Exchange server, run the following command to indicate that the public folder migration is complete:

    Set-OrganizationConfig -PublicFolderMigrationComplete:$true
    
  5. After you've verified that the migration is complete, on the Exchange 2016 server, run the following command:

    Set-OrganizationConfig -PublicFoldersEnabled Local
    
  6. Finally, if you want external senders to send mail to the migrated mail-enabled public folders, the Anonymous user needs to be granted at least the Create Items permission. If you don't do this, external senders will receive a delivery failure notification and the messages won't be delivered to the migrated mail-enabled public folder.

    You can use the Exchange Management Shell or Outlook to set the permissions on the Anonymous user. To read more about how to set permissions on the Anonymous user, see Mail-enable or mail-disable a public folder.

How do I know this worked?

In Step 2: Prepare for the migration, you were instructed to take snapshots of the public folder structure, statistics, and permissions before the 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 new folder structure.

    Get-PublicFolder -Recurse | Export-CliXML C:\PFMigration\Cloud_PFStructure.xml
    
  2. Run the following command to take a snapshot of the public folder statistics such as item count, size, and owner.

    Get-PublicFolderStatistics -ResultSize Unlimited | Export-CliXML C:\PFMigration\Cloud_PFStatistics.xml
    
  3. Run the following command to take a snapshot of the permissions.

    Get-PublicFolder -Recurse | Get-PublicFolderClientPermission | Select-Object Identity,User -ExpandProperty AccessRights | Export-CliXML  C:\PFMigration\Cloud_PFPerms.xml
    

Remove public folder databases from the legacy Exchange servers

After the migration is complete, and you have verified that your Exchange 2016 public folders are working as expected, you should remove the public folder databases on the legacy Exchange servers.

Important

Since all of your mailboxes have been migrated to Office 365 prior to the public folder migration, we strongly recommend that you route the traffic through Office 365 (decentralized mail flow) instead of centralized mail flow through your on-premises environment. If you choose to keep mail flow centralized, it could cause delivery issues to your public folders, since you've removed the public folder mailbox databases from your on-premises organization.

For details about how to remove public folder databases from Exchange 2010 servers, see Remove Public Folder Databases.

Roll back the migration

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

Warning

If you roll your migration back to the legacy Exchange servers, you will lose any email that was sent to mail-enabled public folders or content that was posted to public folders in Exchange 2016 after the migration. To save this content, you need to export the public folder content to a .pst file and then import it to the legacy public folders when the rollback is complete.

  1. On the legacy Exchange server, run the following command to unlock the legacy Exchange public folders. This process may take several hours.

    Set-OrganizationConfig -PublicFoldersLockedForMigration:$False
    
  2. On the Exchange 2016 server, run the following commands to remove the public folder mailboxes.

        Get-Mailbox -PublicFolder | Where {$_.IsRootPublicFolderMailbox -eq $false} | Remove-Mailbox -PublicFolder -Force -Confirm:$false
    
        Get-Mailbox -PublicFolder | Remove-Mailbox -PublicFolder -Force -Confirm:$false
    
  3. On the legacy Exchange server, run the following command to set the PublicFolderMigrationComplete flag to $false.

    Set-OrganizationConfig -PublicFolderMigrationComplete:$False