Part 4: Step-by-Step Exchange 2007 to 2013 Migration

In part 1 we covered the deployments steps for Exchange 2013, in Part 2 of this series we covered Exchange 2013 configurations and testing, in part 3 started our migration process. In this final post we will walk through the final steps in migration, then remove our legacy server.

Important Update was released by the Exchange Team to enhance the discover of legacy public folders, the details and configurations for this update are well documented in this post, and must be followed before continue with the below steps.

8.Public Folder Migration

This phase is very well documented online, accordingly we will walk through the steps with minimum explanations, to understand the whole processes check this Link.

Before you begin Download all four of the Microsoft Exchange 2013 public folder migration scripts.

Preparation (take a snapshot from current Public Folders)

Open Exchange 2007 Management Shell and run the following commands:

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


Rename Folders with backslash

If the name of a public folder contains a backslash \, the public folders will be created in the parent public folder when migration occurs. You have to rename any public folders that have a backslash in the name.

To get Public folders with backslash, run the following command:

Get-PublicFolderDatabase | ForEach {Get-PublicFolderStatistics -Server $_.Server | Where {$_.Name -like "*\*"}}


Change the public folder name as shown below:

Set-PublicFolder -Identity 000000001A447390AA6611CD9BC800AA002FC45A0300D13A87259D34A142BB480F3E89AA82BF00004FD5389E0000 -name "MCS TF2"


Make sure there is no previous record of a successful migration

Get-OrganizationConfig | Format-List PublicFoldersLockedforMigration, PublicFolderMigrationComplete


Generate the CSV files

On Exchange 2007 run the below script to create the folder name-to-folder size mapping file, the file will create the folders and its sizes

.\Export-PublicFolderStatistics.ps1 PFStat.csv e12-01



Copy this file to Exchange 2013 and run the below script to create the second CSV, which will let you know how many mailboxes will be required for your folders based on the mailbox you will set as show below:

.\PublicFolderToMailboxMapGenerator.ps1 1GB PFStat.csv FolderToMailbox.csv


As I have a very small PF only one Mailbox is required as below:


Create the required mailbox/s as shown below:

New-Mailbox -PublicFolder Mailbox1 –Database DB01 –HoldForMigration: $true


Start the Migration Request

New-PublicFolderMigrationRequest -SourceDatabase (Get-PublicFolderDatabase -Server e12-01.contoso.local) -CSVData (Get-Content FolderToMailbox.csv -Encoding Byte)


Check the status

Once the migration reached the AutoSuspended state as shown below, proceed to the next steps, otherwise you must wait as this may take some time based on your PF size.

Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics


Lock Down PF for Migration (Down time is required, as during this phase PF will bot be accessible for all users)

Set-OrganizationConfig -PublicFoldersLockedForMigration:$true


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

Resume-PublicFolderMigrationRequest -Identity \PublicFolderMigration


Test and Unlock the PF Migration

I will configure a test user to use the new PF using the following command:

Set-Mailbox -Identity mohsaeed -DefaultPublicFolderMailbox mailbox1


Open the test user mailbox and run some tests: Create new post, view old posts, check permissions

If all tests passed successful proceed to next step.

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

Set-OrganizationConfig -PublicFolderMigrationComplete:$true



Decommissioning Exchange 2007

Remove Mailbox Databases, open Exchange 2007 management shell, and run the following command:

Get-MailboxDatabase | Remove-MailboxDatabase


Remove your PF Databse using guidelines in this link.

Open cmd, navigate to bin directory and run the below command: /mode:uninstall




Comments (48)

Cancel reply

  1. Gavin says:

    Does one uninstall the exchange 2007 edge server as well ?

  2. What about PF migration if I have more than one PF database on Exchange 2007? Should I wait for copying all PF in each database then lock them, and repeat this for each PF database?

  3. Bless You says:

    Great and useful Article tx for your time sharing it with us !!!!

  4. james says:

    Hey Tom.  Techs do things in the command line.  His process was right on.  

  5. @Mihail Stacanov

    Right, you should wait for copying all PF DB then lock them and repeat all steps. PF Migration step is painful, finally don't forget latest CU2 update! There is a bug in Exchange Server 2013 CU2 about PF permissions. You should install all Exchange Server 2013 with the latest updates.

    Check this out;…/now-available-updated-release-of-exchange-2013-rtm-cu2.aspx

  6. Nilesh says:

    Great article, spot on made my migration so much easy. thanks for sharing

  7. Golfer_Kuno says:

    We have many Distribution Group (that were created in Exchange 2007)… how do we go about migrating with these groups? Thank you

  8. SCollins says:

    In previous version migrations, I’m used to having the need to move arbitration or system mailboxes from the old server prior to deleting the legacy MB DB. I can’t find any good info anywhere else to know if this is required and what steps are needed – Ex2007 –>Ex 2013

  9. Enrico Giacomin says:

    Hello Mohammad,
    thank you for your quick guide. It is essential and useful.
    I found an issue during a migration. The http redirect to the exchane 2007 always prompt for double credential. One on the EX2013 owa and then to the Ex2007.
    At the end I was able to pass through the credential between 2k13 and 2k7 configuring the owa vtrutal directory on 2k7:
    Set-OwaVirtualDirectory -Identity “CAS_Server_NameOWA (Default Web Site)” –ExternalURL $Null –formsAuthentication $true –WindowsAuthentication $true.

    Sincerely, it works, but it seems a bit strange to me I have to activate the FBA

  10. Zeth Palmgren says:

    Can you verify that this command Set-OrganizationConfig -PublicFoldersLockedForMigration:$true is run on the new Exchange server and not the old? The screendump doesn’t say wich server it’s run on.

  11. Eddie_M says:

    First of all, THANK YOU for writing up this post. I’m sure it is useful for "some" folks is not for all. I did well all the way until this page. I get all the to "Start the Migration Request" and things fall apart there. This is what I get…. [PS] C:PFScripts>New-PublicFolderMigrationRequest
    -SourceDatabase (Get-PublicFolderDatabase -Server SRVMAIL1.intermedia -CSVData (Get-Content FolderToMailbox.csv -Encoding Byte) Couldn’t connect to the source mailbox. + CategoryInfo : NotSpecified: (:) [New-PublicFolderMigrationRequest],
    RemoteTransientException + FullyQualifiedErrorId : [Server=SRVMAIL2,RequestId=3c0b298c-9742-41b4-afbe-0db8389bacef,TimeStamp=2/10/2014 8:51 :21 PM] B2D33BC1,Microsoft.Exchange.Management.RecipientTasks.NewPublicFolderMigrationRequest + PSComputerName :
    Any help is very much appreciated.

  12. Eddie_M says:

    [PS] C:PFScripts>New-PublicFolderMigrationRequest -SourceDatabase (Get-PublicFolderDatabase -Server SRVMAIL1.intermedia -CSVData (Get-Content FolderToMailbox.csv -Encoding Byte) Couldn’t connect to the source mailbox. + CategoryInfo
    : NotSpecified: (:) [New-PublicFolderMigrationRequest], RemoteTransientException + FullyQualifiedErrorId : [Server=SRVMAIL2,RequestId=3c0b298c-9742-41b4-afbe-0db8389bacef,TimeStamp=2/10/2014 8:51 :21 PM] B2D33BC1,Microsoft.Exchange.Management.RecipientTasks.NewPublicFolderMigrationRequest
    + PSComputerName :

  13. Eddie_M says:

    Sorry about the duplicate.

  14. the.shirini says:

    Thanks a lot 🙂

  15. _Damo_ says:

    Great article, provides exactly whats needed and links to external sources if you need more explanation of the commands.

  16. tomasz1 says:

    Great article but I have red error when I run .Export-PublicFolderStatistics.ps1 xxx.csv servername. Error is Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
    At C:PFScriptsExport-PublicFolderStatistics.ps1:16 char:168
    + HelpMessage = "Full path of the output file to be generated. If only filename is specified, then the output file w
    ill be generated in the current directory.")] <<<<
    any help ?

  17. Stefan Korn says:

    Hi Tomasz, had the same problem this weekend. You have to install Powershell 2.0 on the source server for the scripts to run succesfully. Got it from here: (only Windows Management Framework Core (WinRM 2.0 und Windows PowerShell 2.0 was necessary for me.)

  18. It floors me that they don’t allow spaces for Public Folders in 2013. Nearly every one of my clients has spaces in public folder names, why would this not be supported?

  19. Nathan von Alemann says:

    Very useful.
    Before uninstall Exchange 2007 I had to remove the SendConnector
    Set-SendConnector -Identity Outbound -SourceTransportServers Ex2013

    and remove the OAB.
    Get-OfflineAddressBook -Server Ex2007 | Remove-OfflineAddressBook


  20. Woody says:

    Just followed this guide for a customers Exchange migration.
    Everything worked great.
    Had some problems with PF migration but it was a great guide overall.
    Thanks Mohammad

  21. hwelvaar says:

    Hey Mohammed, thanks for this extensive procedure !

  22. Ndubbz says:

    Used your step by step process like a charm. Great resource

  23. Denis says:

    Thanks, but you have not mention about DAG and Witness server… this is helpful for small organization where DAG are not require… so can you mention the process for DAG as well.

  24. @Denis the purpose of this post was to go through the steps of upgrading Exchange 2007 to 2013, DAG is a huge topic to cover; maybe in a separate post in the future…
    Some useful links help you with planning and creating DAG:
    Understand and Plan for DAG
    Create and Manage DAG

  25. Dave says:

    Set-OrganizationConfig -PublicFoldersLockedForMigration:$true – must perform on the legacy Server!

  26. John_Morgan says:

    Maybe a silly question, but just so I understand…if the current environment is not using PublicFolders, must there still be a migration to the new Exch2013 server for a clean uninstall of Exchange 2007 server?

  27. shawn says:


    I’m trying to migrate but I’m getting an error:

    .Export-PublicFolderStatistics.ps1 is not recognized as the name of a cmdlet, function,script, etc. Check the spelling of the name……. line:1 Char:32

    [PS] C:Usersda_sowensDesktop>.Export-PublicFolderStatistics
    The term ‘.Export-PublicFolderStatistics’ is not recognized as the name of a cmdlet, function, script file, or operabl
    e program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:32
    + .Export-PublicFolderStatistics <<<<
    + CategoryInfo : ObjectNotFound: (.Export-PublicFolderStatistics:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    [PS] C:Usersda_sowensDesktop>Get-Host

    Name : ConsoleHost
    Version : 2.0
    InstanceId : 6a08da54-f956-47d5-b0c2-5c07ce2b61e8
    UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
    CurrentCulture : en-AU
    CurrentUICulture : en-US
    PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
    IsRunspacePushed : False
    Runspace : System.Management.Automation.Runspaces.LocalRunspace

  28. @shawn did you download the PF scripts mentioned in the beginning of this post ?

  29. MH says:


    1. You’re missing the ".ps1" at the end of your command
    2. Be sure the script is in the directory that you’re running the shell from. If Export-PublicFolderStatistics.ps1 is not on your desktop, you’ll need to "cd" to the folder containing the script

  30. Shauns says:

    I’m having the same issue as you Eddie, I’ve triple checked my steps so I don’t know where to go next. Any pointers are much appreciated!


  31. Bryan says:

    I am also having the same problem as Eddie.

    [PS] C:pfmigration>New-PublicFolderMigrationRequest -SourceDatabase (Get-PublicFolderDatabase -Server exch2007.domain.local) -CSVData (Get-Content FolderToMailbox.csv -Encoding Byte)
    Couldn’t connect to the source mailbox.
    + CategoryInfo : NotSpecified: (:) [New-PublicFolderMigrationRequest], RemoteTransientException
    + FullyQualifiedErrorId : [Server=exch2013,RequestId=6e58ce6f-6d39-4ee9-938b-98126b9c6f0a,TimeStamp=2/4/2015 8:51:
    20 PM] [FailureCategory=Cmdlet-RemoteTransientException] 19495301,Microsoft.Exchange.Management.RecipientTasks.New
    + PSComputerName : exch2013.domain.local

  32. Bryan says:

    Fixed my issue. Just had to install the latest Exchange 2007 updates and reboot the server.

  33. Dave P says:

    I want to thank you for this article, as it was critical in providing a guideline for my first (and hopefully only) migration from Exchange 2007 on a 2003 OS to Exchange 2013 on 2012 R2. Any admin or engineer with some experience and sense will be able
    to resolve issues as they arise, as I have. The information is out there! This guide is a superb step-by-step and it will become a part of my personal knowledge base; so thanks again!

  34. jimmy says:

    Bryan – legend thanks – that sorted me too. Only had SP2 on Exchange, put SP2 CU16 on and that sorted it.

  35. Viresh Kumar says:

    Great and useful Article

  36. prasant says:

    .PublicFolderToMailboxMapGenerator.ps1 1GB PFStat.csv FolderToMailbox.csv scripts needs to be run on Exchagne 2007 instead of 2013 and Set-OrganizationConfig -PublicFoldersLockedForMigration:$true is posted without title bar makes it difficult to figure
    out which exchange server it is. Other than that all the screenshots and command are very helpful

  37. Vicki says:

    We do not need any of the old public folders on our 2007 server moved to our 2013 server. I deleted all the public folders under the DEFAULT PUBLIC FOLDERS on the 2007 server. I did NOT delete anything under the SYSTEM PUBLIC FOLDERS. But I cannot delete
    the public folder database because it says there are still replicas. How can I find what the replicas are and DELETE them? I do NOT want any of that data. Do we HAVE to migrate the SYSTEM PUBLIC FOLDERS?

  38. mohammed ifthaker houssain says:


  39. Saquib Zafar says:

    Need to list down all possible downtime required during Exchange 2007 to 2013 migration phase also with Change management. Just to list down the activates where we would need downtime.

  40. hello!
    Thanks for sharing !

    But i have an issue with Microsoft ActiveSync.. I can send emails from Ex2007 to Ex2013.. Ex2013 to Ex2007.. Ex2007 to internet, Ex2013 to internet… I can send emails from OWA but…
    with my cellphone, i can recieve mails but not send!

    Do you have any clue for this issue please? it s been 2 weeks i am on it.. -__-

  41. lucy says:

    Great post from your hands again. I loved the complete article.
    By the way nice writing style you have. I never felt like boring while reading this article.

    I will come back & read all your posts soon. Regards, Lucy.

  42. Armin John says:

    Indeed a very useful and indispensable article. Thanks much!

  43. cj says:

    I have migrated mailboxes to new 2013 server months ago. I want to decommission the old server. I still see all the mailboxes on the old server. Does this seem right? All modified dates are 3 months old.

  44. mikek says:

    I have problem with KB2619234. This instalation is still runnig. I have message Installing Hotfix for Windows (KB2619234) (update 1 of 1) for 8hours…. I have W2008R2SP1.

  45. John Mitchell says:

    You might want to cover in your instructions on how to do this with Office 365, including the synchronizing of mail-enabled public folder information to Azure AD/Exchange Online.

  46. rabi says:

    Thank you for such an excellent article, it helped alot to migrate LIVE mail services from Exg 2007 to 2013. I appreciate all who contributed and shared migration experience and expert opinion for quick resolution.

Skip to main content