Migrate Public Folders

By | February 15, 2017


This will work for moving PFs from 2007 or 2010 to 2013 or 2016

1.  Legacy & Destination Server: Download Scripts: Export-PublicFolder PS1 Scripts & Extract to C:\PFScripts\

2. Legacy Server: Export structure

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

3. Legacy Server: Locate and rename PFs with “\”

Locate on 2010:
Get-PublicFolderStatistics -ResultSize Unlimited | Where {($_.Name -like "*\*") -or ($_.Name -like "*/*") } | Format-List Name, Identity
Locate on 2007:
Get-PublicFolderDatabase | ForEach {Get-PublicFolderStatistics -Server $_.Server | Where {$_.Name -like "*\*"}}
Rename with:
Set-PublicFolder -Identity <public folder identity> -Name <new public folder name>
Trim folder names with leading or trailing blank spaces
Get-PublicFolder -Identity "\" -Recurse -ResultSize Unlimited | Foreach { Set-PublicFolder -Identity $_.Identity -Name $_.Name.Trim() }

4. Legacy Server: Disable previous migrations

Check for migrations:
Get-OrganizationConfig | Format-List PublicFoldersLockedforMigration, PublicFolderMigrationComplete
Reset status (may take up to 2 hours):
Set-OrganizationConfig -PublicFoldersLockedforMigration:$false -PublicFolderMigrationComplete:$false

5. Destination Server: Disable previous migrations

Check for serial migrations:
Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics -IncludeReport | Format-List
Remove serial migrations:
et-PublicFolderMigrationRequest | Remove-PublicFolderMigrationRequest
Check for batch migrations:
$batch = Get-MigrationBatch | ?{$_.MigrationType.ToString() -eq "PublicFolder"}
Remove batch migrations:
$batch | Remove-MigrationBatch -Confirm:$false

6. Destination Server: Verify no PFs exist

Check with:
Get-Mailbox -PublicFolder 
Remove with (all data will be destroyed):
Get-Mailbox -PublicFolder | Where{$_.IsRootPublicFolderMailbox -eq $false} | Remove-Mailbox -PublicFolder -Force -Confirm:$false
Get-Mailbox -PublicFolder | Remove-Mailbox -PublicFolder -Force -Confirm:$false

7. Legacy Server: Create the folder mapping files

Folder name-to-folder size mapping file:
.\Export-PublicFolderStatistics.ps1  c:\PFScripts\SizeMap.csv "<FQDN of source server>"
Folder-to-mailbox mapping file:
.\PublicFolderToMailboxMapGenerator.ps1 "<Maximum mailbox size in bytes>" c:\PFScripts\SizeMap.csv c:\PFScripts\FolderMap.csv

8: Destination Server: Create the Public Folders

Copy c:\PFScripts\FolderMap.csv from legacy to destination c:\PFScripts

.\Create-PublicFolderMailboxesForMigration.ps1 -FolderMappingCsv c:\PFScripts\FolderMap.csv -EstimatedNumberOfConcurrentUsers: "<estimate>"

9: Destination Server: Migrating from 2007 to 2013 Start the migration

Set values:
$PublicFolderDatabasesInOrg = @(Get-PublicFolderDatabase)
$BadItemLimitCount = 5 + ($PublicFolderDatabasesInOrg.Count -1)
Exchange 2013 setup:
New-MigrationBatch -Name PFMigration -SourcePublicFolderDatabase (Get-PublicFolderDatabase -Server "<Source server name>") -CSVData (Get-Content c:\PFScripts\FolderMap.csv -Encoding Byte) -NotificationEmails "administrator@domain.com" -BadItemLimit $BadItemLimitCount 2013 Start migration: Start-MigrationBatch PFMigrationStart migration:
Start-MigrationBatch PFMigration

9: Destination Server: Migrating from 2010 to 2013 Start the migration

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>" 
Start-MigrationBatch PFMigration

10. Check Migration status

Get Status of the migration:
Compare item counts and data size between source and destination:
Get-MailboxStatistics -server "post"| Sort-Object datadase,TotalItemSize –Descending | select DisplayName,database,ItemCount,TotalItemSize

11. Legacy Server: Lock Down PFs

Set-OrganizationConfig -PublicFoldersLockedForMigration:$true

12. Destination Server: Finalize the migration

Set-OrganizationConfig -PublicFoldersEnabled Remote
Complete-MigrationBatch PFMigration

13. Destination Server: Test and unlock the migration

Set-Mailbox -Identity "Test User" -DefaultPublicFolderMailbox "Public Folder Mailbox Identity"

Then test access from user accounts

14. Legacy Server: Set migration to complete

Set-OrganizationConfig -PublicFolderMigrationComplete:$true

15. Destination Server: Set migration to complete

Set-OrganizationConfig -PublicFoldersEnabled Local