Management

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 772 other subscribers

Social

  • LinkedIn
  • RSS Feed for Posts
  • Twitter
  • StumbleUpon

Exchange 2010 to Exchange 2013 Public Folder Migration.

Last week I had to migrate a client from Exchange 2010 to Exchange 2013.

Of course I had to migrate the public folders. During the migration I ran in to some errors, they are explained below.

Doing so I used the Microsoft way : Migrate Public Folders to Exchange 2013 From Previous Versions

Keep the Microsoft website as a leading guideline, and use the tips below to come to a successful migration.

( XCH03 is the Exchange 2010 server, XCH05 is the Exchange 2013 server )

STEP 1 :

First download the public folder scripts : Microsoft Exchange 2013 public folder migration scripts.

 

STEP 2 :

On Exchange 2010:

Create a backup :

Get-PublicFolder -Recurse | Export-CliXML C:\PFMigration\Legacy_PFStructure.xml

Get-PublicFolderStatistics -ResultSize Unlimited | 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

Check the public folders

Get-PublicFolderStatistics -ResultSize Unlimited | Where {$_.Name -like “*\*”} | Format-List Name, Identity

Change all of the public folders listed in the command above :

Set-PublicFolder -Identity <public folder identity> -Name <new public folder name>

Check if there is a succesfull migration or not (the result must be False ! )

Get-OrganizationConfig | Format-List PublicFoldersLockedforMigration, PublicFolderMigrationComplete

If the result above is True you must change it to False 

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

 

On Exchange 2013:

Check old migration request

Get-PublicFolderMigrationRequest | Remove-PublicFolderMigrationRequest -Confirm:$false

Get-Mailbox -PublicFolder

Get-PublicFolder

If there is an existing Public folder, delete it :

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

Get-Mailbox -PublicFolder | Remove-Mailbox -PublicFolder -Force -Confirm:$false

 

STEP 3 :

On Exchange 2010 :

.\Export-PublicFolderStatistics.ps1 \\xch05\d$\Install\Exchange-2013\Public-folder\name-to-folder-size-mapping.csv xch03.Domain.local

.\PublicFolderToMailboxMapGenerator.ps1 500MB \\xch05\d$\Install\Exchange-2013\Public-folder\name-to-folder-size-mapping.csv \\xch05\d$\Install\Exchange-2013\Public-folder\folder-to-mailbox.csv

 

STEP 4 :

On Exchange 2013 :

New-Mailbox -PublicFolder PF01 -HoldForMigration:$true

Check the file created above (\\xch05\d$\Install\Exchange-2013\Public-folder\folder-to-mailbox.csv)

 

Change the number of mailboxes below to the correct number listed in the file above ! Count every single folder!

 

Run the following script :

 

$numberOfMailboxes = 19;

for($index =1 ; $index -le $numberOfMailboxes ; $index++)

{

$PFMailboxName = “Mailbox”+$index; if($index -eq 1) {New-Mailbox -PublicFolder $PFMailboxName -HoldForMigration:$true -IsExcludedFromServingHierarchy:$true;} else { New-Mailbox -PublicFolder
$PFMailboxName -IsExcludedFromServingHierarchy:$true}

}

 

Be sure to use this script, because the site from Microsoft has some errors in the script (noted in RED)

 

STEP 5 :

From the Exchange 2013 server :

 

New-PublicFolderMigrationRequest -SourceDatabase (Get-PublicFolderDatabase -Server XCH03) -CSVData (Get-Content \\xch05\d$\Install\Exchange-2013\Public-folder\folder-to-mailbox.csv -Encoding Byte) -AcceptLargeDataLoss true -BadItemLimit 1000

 

Check the migration:

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

or

Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics -IncludeReport | Format-List status, BytesTransferred, ItemsTransferred, PercentComplete, report

 

At this time I received this error :

12/4/2013 9:59:24 PM [XCH05] Folder creation progress: 0 folders created in mailbox

‘5f5f2a47-b856-45b6-98cf-c929c65f7592’.

12/4/2013 10:00:31 PM [XCH05] Folder hierarchy initialized for mailbox

‘5f5f2a47-b856-45b6-98cf-c929c65f7592’: 1284 folders created.

12/4/2013 10:00:31 PM [XCH05] Fatal error DataValidationException has occurred.

 

As you can see, we have issues with the illegal characters Alias of some Public Folders. After investigating the ones with issues, it appears that the folders in question have spaces either leading, trailing or otherwise. How do we get rid of the space? First, let’s verify the groups have these characters:

 

$pfs= Get-publicfolder “\” -ResultSize Unlimited -recurse | where {$_.MailEnabled -eq “True”} | Get-MailPublicFolder | where {$_.alias -like ‘* *’ -or $_.alias -like ‘*,*’}

 

foreach($pf in $pfs) {set-mailpublicfolder $pf.Identity -Alias:($pf.alias -replace ‘\s|\,’,)}

 

(Be sure the last character’s are 2 single ‘ not 1 ” !!)

 

This command can’t handle more than 2 selections !

If you receive an error like above, you need change the public folder manually

I’ve used these command’s to change all of the bad charakters:

 

Repeat these steps until no errors are stated

 

Check for ‘Space’ and ‘,’

$pfs= Get-publicfolder “\” -ResultSize Unlimited -recurse | where {$_.MailEnabled -eq “True”} | Get-MailPublicFolder | where {$_.alias -like ‘* *’ -or $_.alias -like ‘*,*’}

 

write-host $pfs

 

foreach($pf in $pfs) {set-mailpublicfolder $pf.Identity -Alias:($pf.alias -replace ‘\s|\,’,”)}

 

Check for ‘ (‘ and ‘)’

$pfs= Get-publicfolder “\” -ResultSize Unlimited -recurse | where {$_.MailEnabled -eq “True”} | Get-MailPublicFolder | where {$_.alias -like ‘*(*’ -or $_.alias -like ‘*)*’}

 

write-host $pfs

 

foreach($pf in $pfs) {set-mailpublicfolder $pf.Identity -Alias:($pf.alias -replace ‘\(|\)’,”)}

 

Check for ‘space’ and ‘.’

$pfs= Get-publicfolder “\” -ResultSize Unlimited -recurse | where {$_.MailEnabled -eq “True”} | Get-MailPublicFolder | where {$_.alias -like ‘* *’ -or $_.alias -like ‘*.*’}

 

write-host $pfs

 

foreach($pf in $pfs) {set-mailpublicfolder $pf.Identity -Alias:($pf.alias -replace ‘\s|\.’,”)}

 

Be sure the Alias doesn’t contain any illegal characters, of a trailing space and again execute the command :

 

Here You will find the public folders in Adsi Edit, in case you have to edit them

New-PublicFolderMigrationRequest -SourceDatabase (Get-PublicFolderDatabase -Server XCH03) -CSVData (Get-Content \\xch05\d$\Install\Exchange-2013\Public-folder\folder-to-mailbox.csv -Encoding Byte) -AcceptLargeDataLoss true -BadItemLimit 1000

 

Again there was an error :

 

Message : Error: Property expression “Organization(409)” isn’t valid. Valid values are:

Strings formed with characters from A to Z (uppercase or lowercase), digits from 0

to 9, !, #, $, %, &, ‘, *, +, -, /, =, ?, ^, _, `, {, |, } or ~. One or more

periods may be embedded in an alias, but each period should be preceded and

followed by at least one of the other characters. Unicode characters from U+00A1 to

U+00FF are also valid in an alias, but they will be mapped to a best-fit US-ASCII

string in the e-mail address, which is generated from such an alias.

 

12/9/2013 6:44:03 PM [XCH05] Request processing started.

12/9/2013 6:44:06 PM [XCH05] Stage: CreatingFolderHierarchy. Percent complete: 10.

12/9/2013 6:44:07 PM [XCH05] Initializing folder hierarchy from mailbox ”: 1319 folders total.

12/9/2013 6:44:07 PM [XCH05] Folder creation progress: 0 folders created in mailbox

‘5f5f2a47-b856-45b6-98cf-c929c65f7592’.

12/9/2013 6:45:13 PM [XCH05] Folder hierarchy initialized for mailbox

‘5f5f2a47-b856-45b6-98cf-c929c65f7592’: 1288 folders created.

12/9/2013 6:45:16 PM [XCH05] Fatal error DataValidationException has occurred.

 


 

Get-PublicFolderMigrationRequest |fl

 

RunspaceId : d4de9efa-b7db-42f2-ace3-accb57afa36c

SourceDatabase : Public Folder Database 0571046606 – Exchange 2010

Name : true

RequestGuid : ac2fe427-a124-48db-9537-3cc382ef1d47

RequestQueue : Mailbox Database 1177154645

Flags : IntraOrg, Pull, Suspend, SuspendWhenReadyToComplete

BatchName :

Status : Failed

Protect : False

Suspend : True

Direction : Pull

RequestStyle : IntraOrg

OrganizationId :

WhenChanged : 12/9/2013 6:45:15 PM

WhenCreated : 12/9/2013 6:43:53 PM

WhenChangedUTC : 12/9/2013 5:45:15 PM

WhenCreatedUTC : 12/9/2013 5:43:53 PM

Identity : \true

IsValid : True

ObjectState : New

 

Search in the earlier created file \\xch05\d$\Install\Exchange-2013\Public-folder\name-to-folder-size-mapping.csv for the name “Organization(409)”

 

Then on the old Exchange server (XCH03) search in the public folder database :

Change the Alias from Organization(409) to organization409

 

Resume the Public folder Migration :

 

Get-PublicFolderMigrationRequest | Resume-PublicFolderMigrationRequest

 

Check the Migration again :

 

Get-PublicFolderMigrationRequest

 

Name SourceDatabase Status

—- ————– ——

true Public Folder Database 0571046606 – Exchang… InProgress

 

The migration is working now !

 

Again check the migration:

 

Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics -IncludeReport | select Status, Message, report |Format-List

 

After 45 min :

 

changed messages.

12/9/2013 7:56:39 PM [XCH05] Incremental Sync ‘b2f7f2a9-1d42-47b9-b676-67e4fcb7e5a4’ completed: 0 changed

folders, 0 changed messages.

12/9/2013 7:56:39 PM [XCH05] Stage: IncrementalSync. Percent complete: 95.

12/9/2013 7:56:39 PM [XCH05] Automatically suspending job.

 

 

STEP 6 : Downtime required !

Locking the old Public folders on E2010 :

 

Set-OrganizationConfig -PublicFoldersLockedForMigration:$true

 

STEP 7 : Downtime required !

 

Set the PreventCompletion option on the E2013 :

 

Set-PublicFolderMigrationRequest -Identity \PublicFolderMigration -PreventCompletion:$false

Resume-PublicFolderMigrationRequest -Identity \PublicFolderMigration

 

Check :

 

Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics

 

Name StatusDetail     SourceDatabase         PercentComplete

—-      ————      ————–         —————

true     Completed     Public Folder Database 0571046606 …     100

 

Pass same public folders for testing :

 

set-mailbox PF-01 -publicfolder -IsExcludedFromServingHierarchy $False

set-mailbox mailbox1 -publicfolder -IsExcludedFromServingHierarchy $False

 

 

 

Set the DefaultPublicFolderMailbox for a test user (TestUser) :

 

[PS] C:\Windows\system32>Get-Mailbox -Identity TestUser| Select DefaultPublicFolderMailbox

 

DefaultPublicFolderMailbox

————————–

 

[PS] C:\Windows\system32>Set-Mailbox -Identity TestUser-DefaultPublicFolderMailbox mailbox1

[PS] C:\Windows\system32>Get-Mailbox -Identity TestUser| Select DefaultPublicFolderMailbox

 

DefaultPublicFolderMailbox

————————–

domain.local/Users/Mailbox1

 

Test the Public Folders in outlook for the test user (TestUser)

 

Test the public folder :

  • Check the folders
  • Check the access rights
  • Create a folder
  • Send a e-mail to the address of this folder
  • Copy several e-mail tot his folder
  • Open the e-mails
  • Delete the e-mails
  • Delete the test folder

 

Release all Public Folders :

 

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

 

Chack the migration again (This should be on 100% ) :

 

Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics

 

 

Complete the migration on E2010 :

 

Set-OrganizationConfig -PublicFolderMigrationComplete:$true

 

STEP 8 :

Create XML files on E2013 :

 

Get-PublicFolder -Recurse | Export-CliXML C:\PFMigration\Legacy_PFStructure.xml

Get-PublicFolderStatistics -ResultSize Unlimited | 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

 

Compare the XML files :

 

Compare-object (get-content C:\PFMigration\Legacy_PFPerms.xml) (get-content C:\PFMigration\New_PFPerms.xml)

Compare-object (get-content C:\PFMigration\Legacy_PFStructure.xml) (get-content C:\PFMigration\New_ PFStructure.xml )

 

 

If the output is ‘null’ => Everything is OK, the files are the same !

 

Dismount the old Public folder on the OLD XCH03

 

Again check the public Folders in Outlook :

 

Everything is working !

 

Good luck !
Remove public folder databases from the legacy Exchange servers


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

 

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:

 

  • 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

  • On the Exchange 2013 server, run the following command to delete 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

  • On the legacy Exchange server, run the following command to set the PublicFolderMigrationComplete flag to $false.

Set-OrganizationConfig -PublicFolderMigrationComplete:$False