Migrate from Exchange Server 2007 to Exchange Server 2013

Before planning your Exchange Server 2013 migration, you need to ensure that you are familiar with all its features like virtualization, retention, modern public folders, managed availability, transport, unified messaging, EWS, Outlook Web App etc.

As Exchange is critical to the communication network, it is important to do a smooth Exchange migration which causes minimum or zero interruption to the organizational communication. In this blog, we will see how to migrate all users and services from Exchange 2007 to Exchange 2013 and finally decommission the old Exchange 2007.

Step 1: Deploying Exchange 2013 as new environment

Active Directory Preparation :

When we install Exchange Server, it needs to store User mailboxes’ and Exchange Server’s configuration information in the organization. So it is important that Active Directory is duly prepared before you install Exchange 2013 in the organization.
Following things need to be done before you deploy Exchange Server 2013 in the environment :
A) Extend Active Directory Schema
B) Prepare Active Directory and
C) Prepare Active Directory Domains

To ensure that AD preparation is done correctly, verify that the rangeUpper property on ms-Exch-Schema-Version-Pt is set to the correct value. After this force AD replication.

Exchange Server 2013 Installation :
When you are ready for running Exchange Server setup, ensure that server is fully updated with latest patches. To install Windows Features using PowerShell Run Windows PowerShell as Administrator and paste the following command:

Install-WindowsFeature AS-HTTP-Activation, Desktop-Experience, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation

After the installation is complete, Restart your server. And after the reboot, download and install Microsoft Unified Communications Managed API 4.0. Core Run-time 64-bit, Microsoft Office 2010 Filter Packs 64 bit, Microsoft Office 2010 Filter Packs SP1 64 bit.

Step 2: Configuring Digital Certificates

You should be using as few certificates and host names as possible for cost control since certificate providers charge a fee based on number of host names you add to your certificate. By default, Exchange comes with self-signed certificates, we will replace this certificates with the ones relevant to our case.

mail.contoso.com : FQDN for most connections to Exchange including Microsoft Outlook, Outlook Web App, Outlook Anywhere, the Offline Address Book, Exchange Web Services, POP3, IMAP4, SMTP, Exchange Control Panel, and ActiveSync

autodiscover.contoso.com : FQDN used by clients that support Auto discover, including Microsoft Office Outlook 2007 and later versions, Exchange ActiveSync and Exchange Web Services clients

legacy.contoso.com: FQDN used by all external and internal clients for old server i.e. Exchange Server 2007.

Next, We will create certificate request, for this open EMS and run the New-ExchangeCertificate cmdlet command:
Once the certificate is created, get it signed by the appropriate certification authority (CA) and use the Import-ExchangeCertificate to import the certificate.

Then Exchange Server 2013 need to be configured to use the certificates using the Enable-ExchangeCertificate command.

Please note that Enable-ExchangeCertificate cmdlet cannot be used to enable a wildcard certificate for POP and IMAP services, also it cannot be used to enable a certificate for federation.
Use private key to export the certificate and import it on Exchange 2007 CAS servers using the same steps.

Step 3: Configuring Name Space and Virtual Directories for Exchange Server

Follow the given steps to configure Exchange Server 2013 virtual directories using EMS :

Exchange Control Panel
To configure Exchange Control Panel (ECP) virtual directories properties, use Set-EcpVirtualDirectory cmdlet.

Outlook Web App
To configure Outlook Web App virtual directories use Set-OwaVirtualDirectory cmdlet.

Offline Address Book
To configure offline address book virtual directory use Set-OABVirtualDirectory cmdlet.

ActiveSync
Use Set-ActiveSyncVirtualDirectory cmdlet to configure the Microsoft Exchange ActiveSync settings on specified virtual directory.

Web Services
To modify Exchange Web Services virtual directory use Set-WebServicesVirtualDirectory cmdlet on the server running Exchange Server 2013.

AutoDiscover
To set properties on specified Client Access Server objects use Set-ClientAccessServer cmdlet.

Outlook Anywhere
To set properties on a computer running Microsoft Exchange Server 2013 enabled for Microsoft Outlook Anywhere use Set-OutlookAnywhere cmdlet.

Step 4: Offline Address Book (OAB) configuration

In Exchange Server 2013, OABGen (Offline Address Book Generation) service which runs on Mailbox server generates offline address book.

Change the default OAB on Exchange 2013 database using Get-MailboxDatabase and Set-MailboxDatabase

Step 5: Mail Flow Configurations on Exchange 2013

Receive Connector
To create this connector use the New-ReceiveConnector cmdlet.

Send Connector
Now add the new Exchange Server to the existing send connector by the Set-SendConnector cmdlet.

Transport Rules:
Transport rules cannot be migrated from Exchange Server 2007 to 2013. So you need to do the following to get Transport rules in Exchange Server 2013:

Use Export-TransportRuleCollection cmdlet to export all transport rules from Exchange Server 2007
Copy the exported Transport Rule file to the system which has Exchange Server 2013 installed on it
Use Import-TransportRuleCollection cmdlet to import the Transport Rules from the file to the Exchange Server 2013

Step 6: Moving Client Access to Exchange 2013

In the Exchange 2007 management shell you need to run the following commands :

Outlook Web App
Use Set-OwaVirtualDirectory cmdlet to modify properties of MS Outlook Web App virtual directories.

Offline Address Book
Use Set-OABVirtualDirectory cmdlet to configure offline address book virtual directory.

ActiveSync
Use Set-ActiveSyncVirtualDirectory cmdlet to configure the Microsoft Exchange ActiveSync settings on specified virtual directory.

Web Services
To modify Exchange Web Services virtual directory use Set-WebServicesVirtual Directory cmdlet on the server running Exchange Server 2007.

Unified Messaging
To modify an existing Exchange Unified Messaging virtual directory, run the Set-UMVirtualDirectory cmdlet.

Outlook Anywhere
To set Microsoft Outlook Anywhere properties on Microsoft Exchange Server 2007 use Set-OutlookAnywhere cmdlet.

Threat Management Gateway Rules
Now create and update your TMG publish rules.

Next update your publish rules for Exchange 2007 to accept connections for Legacy name space. And then publish Exchange Server 2013 using TMG.

Domain Name System Configurations:

In the Internal DNS, point mail.contoso.com and autodiscover.contoso.com to Exchange 2013 server. And in Legacy.contoso.com new record points to Exchange 2007 Server. In the Public DNS, point mail.contoso.com and autodiscover.contoso.com to TMG listener and for Legacy.contoso.com point new record to TMG Listener.

Step 7: Moving Mailboxes to Exchange 2013

Next you can use New-MoveRequest cmdlet to start mailbox or personal archive migration. To check mailbox readiness before starting to move mailboxes you can use WhatIf parameter. You can also create batch move if you want.

Step 8: Moving Public Folders to Exchange 2013 and decommissioning old Exchange

To start with, take snapshot of the current Public Folders in Exchange Server 2007 EMS using the following commands:
Get-PublicFolder, Get-PublicFolderStatistics and Get-PublicFolderClientPermission.

Next, Create CSV files using scripts (Export-PublicFolderStatistics.ps1 and PublicFolderToMailboxMapGenerator.ps1). In this way you will get the CSV file mapping PFs to new PF mailboxes.

In the Exchange 2013, create PF mailboxes using New-Mailbox –PublicFolder cmdlet. Migrate PF content using New-PublicFolderMigrationRequest cmdlet.

Before starting the final migration, lock down Exchange Server 2007 using the following cmdlets.

Set-OrganizationConfig –PublicFoldersLockedForMigration $True (In Exchange 2007)

Set-PublicFolderMigrationRequest <name> -PreventCompletion $False (In Exchange 2013)

Resume-PublicFolderMigrationRequest <name> (In Exchange 2013)

Test new public folders to ensure everything is alright. Then us the following cmdlet to unlock the PF migration.

Set-OrganizationConfig -PublicFolderMigrationComplete:$true

Step 9: Decommissioning Exchange Server 2007

Open Exchange Server 2007 management shell and run the following command to remove mailbox databases.

Get-MailboxDatabase | Remove-MailboxDatabase

Remove the public database and in the cmd run the following command to uninstall Exchange:

Setup.com /mode:uninstall

The above mentioned steps helps you to complete the entire Exchange Server 2007 to 2013 migration process.

If you have not moved public folder replicas to another server, or if you have not removed all of the public folders in the public folder database, you will receive an error stating that the public folder database cannot be removed because it contains public folder replicas.