Migrate Public Folders to Office 365

How to Migrate Public Folders to Office 365?`

Earlier the  Public Folders used to store in a Public Folder database then moved to Public Folder mailboxes. The Public folder coexists with all the users mailboxes as stored in a regular database.

The Public Folders are created through the Exchange Admin Center(EAC) and Exchange Management Shell (EMS).

It is often seen that users thrive to migrate Public Folders to Office 365 cloud. However, this requires them to perform certain steps in EAC or EMS whichever they like to go through.

Here in this blog I’m sharing with you the two ways to migrate Exchange to Office 365. And the ways are:

  • Exchange Management Shell Method.
  • Automated Method.

Method1: EMS Method to migrate Public Folders to Office 365

Prior Requirements:

Note: Before beginning the process you must know Exchange online comes within Office 365 SaaS. 

Before we begin with the EMS method for the Exchange to Office 365 migration we need to fulfill these criteria first:

  • Only the Exchange 2010 SP3 RU8 or later version enables users to migrate the public folder to Office 365.
  • The Public must not be larger than 25 GB, if it is, then must break into fewer Public folders.
  • In fact, the admin should migrate all the public folders in a single batch. If they create multiple batches simultaneously the result will be an error.
  • However, admin must take care of pre-existing Public folder request on Office 365 and remove them if exists otherwise will get an error.
  • Run the following commands to take snapshots of:
  • Original source structure:

Get-PublicFolder -Recurse -ResultSize Unlimited |             ExportCliXMLC:\PFMigration\Legacy_PFStructure.xml

  • Public Folders:

Get-PublicFolderStatistics -ResultSize Unlimited | Export-CliXML             C:\PFMigration\Legacy_PFStatistics.xml

  • Permissions:

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

Note: These snapshots will be used in the end to ensure that the user migrated public folders to office 365 successfully.


Phas1: Download the various Scripts and Supporting Files

  • Firstly, download the migration scripts from Public Folders Migration Scripts.
  • Now visit Mail-enabled Public Folders – directory sync script to download:
    • Sync-MailPublicFolders.ps1
    • strings.psd1
  • Now download the source side validation script from the given below link:


Consequently, Save all the above supporting scripts and files in the same directory where you will use PowerShell.

Phase2: Generate the CSV file:

  • On Exchange server, to create the folder name and folder size mapping file, run:

Export-PublicFolderStatistics.ps1 <Folder to size map path> <FQDN of source     server>

Only local administrator can perform this command.

  • To create public folder to mailbox mapping file, run:

.\PublicFolderToMailboxMapGenerator.ps1 <Maximum                                                                   mailbox size in bytes> <Folder to size map path>                                                                              <Folder to mailbox map path>

  • Run the given below script in your Exchange Online subsequently to check the space limits of public folder in Exchange online:

                        Get-OrganizationConfig | Format-List *quota*


  • The default values are listed below:

DefaultPublicFolderIssueWarningQuota = 1.7 GB

DefaultPublicFolderProhibitPostQuota = 2 GB

  • The maximum size for public folder mailboxes indeed is 100 GB.
  • Contrarily, the recommended size is 75 GB to let public folder mailbox grow and to avoid performance issues.
  • Accordingly split the public folder or delete its content to limit it to 2 GB or less size.

Phase3: Create the Public Folder Mailboxes in Office 365:

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

Phase4: Start the migration request:

  • Now synchronize the Exchange Public Folder from Local active directory to Exchange Online:

.\Sync-MailPublicFolders.ps1 -Credential (Get-Credential) –                                                            CsvSummaryFile:sync_summary.csv

  • Here get the following information by using the commands:
    • LegacyExchangeDN of the user’s account who is a member of Public Folder Administrator role using the cmdlet:

Get-Mailbox <PublicFolder_Administrator_Account> | Select-Object                                             LegacyExchangeDN

  • LegacyExchangeDN of any Mailbox server that has a public folder database.

Get-ExchangeServer <public folder server> | Select-Object -Expand                                               ExchangeLegacyDN

  • The Hostname of Outlook Anywhere:

Get-OutlookAnywhere | Format-Table Identity,ExternalHostName

  • Now use the Exchange Online Powershell to run the listed below command to let it to use the following credentials to access content over:
    • Pass the credentials of users having administrative rights to the variable $Source_Credential:

$Source_Credential = Get-Credential                                                                                                <source_domain\PublicFolder_Administrator_Account>

  • Pass the ExchangeLegacyDNof the migration user into the variable $Source_RemoteMailboxLegacyDN:

$Source_RemoteMailboxLegacyDN = “<paste the value here>”

  • Use the ExchangeLegacyDN of the public folder server and pass it to the variable $Source_RemotePublicFolderServerLegacyDN:

$Source_RemotePublicFolderServerLegacyDN = “<paste the value here>”

  • Use the External Host Name of Outlook Anywhere into the variable $Source_OutlookAnywhereExternalHostName:

$Source_OutlookAnywhereExternalHostName = “<paste the value here>”

  • Finally run the following commnad to run the migration request:

$PfEndpoint = New-MigrationEndpoint -PublicFolder -Name PublicFolderEndpoint        -RPCProxyServer $Source_OutlookAnywhereExternalHostName -Credentials            $Source_Credential –  SourceMailboxLegacyDN $Source_RemoteMailboxLegacyDN –           PublicFolderDatabaseServerLegacyDN             $Source_RemotePublicFolderServerLegacyDN -Authentication Basic

$bytes = [System.IO.File]::ReadAllBytes(‘folder_mapping.csv’)

New-MigrationBatch -Name PublicFolderMigration -CSVData $bytes –     SourceEndpoint $PfEndpoint.Identity -NotificationEmails <email addresses for       migration notifications>

  • Go with the given below command to start the created migration request:

Start-MigrationBatch PublicFolderMigration

Phase5: Lock the Public Folders in the Local Exchange Server(requires downtime)

  • To ensure the Public folder migration run these two commanads one after another:
    • Cmd1: Get-MigrationBatch |?{$_.MigrationType -like “*PublicFolder*”} | Format-Table *last*sync*
    • Cmd2: Get-PublicFolderMailboxMigrationRequest | Get-PublicFolderMailboxMigrationRequestStatistics | Format-Table targetmailbox,*last*sync*
  • Once you have confirmed the migration batch, lock the public folders for finalization using the below command:

Set-OrganizationConfig -PublicFoldersLockedForMigration:$true

Phase6: Now complete the migration with the command:

Complete-MigrationBatch PublicFolderMigration

(However for large number of target mailboxes the migration status remained synced for longer than 24 hours, wait till it shows completed.)

Phase7:Test and Unlock the Public folder migration:

  • In Exchange Online Powershell, run the following commands to take the snapshots of:
    • Folder structure: Get-PublicFolder -Recurse -ResultSize Unlimited | Export-CliXML C:\PFMigration\Cloud_PFStructure.xml
    • Public Folder: Get-PublicFolderStatistics | Export-CliXML C:\PFMigration\Cloud_PFStatistics.xml
    • & Permissions: Get-PublicFolder -Recurse -ResultSize Unlimited | Get-PublicFolderClientPermission | Select-Object Identity,User -ExpandProperty AccessRights | Export-CliXML C:\PFMigration\Cloud_PFPerms.xml


Now tally these snapshot’s details with the snapshots of Local Exchange Server you took before starting the migration process.

Method2: Automated Way

You may have got to know that the manual method is of course way too typical to migrate Public Folders to Office 365.  Besides, to save you from these unconventional and insecure method, Shoviv Exchange to Office 365 Migration tool is present that makes this task truly lucid. Subsequently, users face no alterations and data loss scenarios in this tool.

The Incremental Export feature of this tool helps in resuming interrupted processes from the last step. Furthermore, this tool comes with simple interface and countless features.

In the Final Analysis:

The Exchange Management Shell method is indeed too typical and unguaranteed method to migrate Public Folders to Office 365. On that it also takes days to complete. So, it would be recommended to the users to use Shoviv Exchange to Office 365 migration tool for speedy, flawless and secure migration. Additionally, this tool also comes with a FREE trial version to allow users to analyze it before purchase.