Monday, March 16, 2015

Performing Exchange 2013 Server Update to the Next Build

Hi folks,

I have recently been involved in activity of upgrading Exchange 2013 server to a later build (CU5 in my scenario).

As you're probably aware there's a new architecture in Exchange 2013 which involves only 2 roles and also MS has paid high attention to the high availability to reduce downtime for Exchange servers. The component that helps achieving this high availability by monitoring every Exchange component and making sure it's up and running. If it can't restore a component it will fail database copies to another server which has all the components healthy. More on Managed Availability can be found here.

Taking this into account there's the whole process of preparing a server for upgrade and then restoring back to its functionality. In fact this can be useful for those who are getting ready for the 70-342 certification exam to achieve their MCSE: Messaging certificate.

Before upgrading your Exchange server you need to ensure that it has no active mailbox database copy running on it and that there's no mail being routed via this server, Additionally any database copy failover to the server being upgraded should be prevented.

The following is the process for preparing a server for the upgrade:

1. We let need to drain all the transport queues on the server to avoid new messages being sent/received by it

Set-ServerComponentState SERVER1 -Component HubTransport Draining -Requester Maintenance

Redirect-Message -Server SERVER1 -Target

Please note that you will need server FQDN for the Target parameter in the second command

2. Suspend node in the DAG:

Suspend-ClusterNode -Name SERVER1

3. Prevent database copies being activated on the server:

Set-MailboxServer SERVER1 -DatabaseCopyActivationDisabledAndMoveNow $true

Set-MailboxServer SERVER1 -DatabaseCopyAutoActivationPolicy Blocked

Set-ServerComponentState SERVER1 -Component ServerWideOffline -State InActive -Requester Maintenance

After this we can perform server upgrade either by running GUI or in unattended mode (my favoirite one) by executing:

setup.exe /m:Upgrade /IAcceptExchangeServerLicenseTerms

Of course, don't forget to navigate to the folder that contains the latest Exchange 2013 binaries.

After this you make yourself a cup of tea or coffee and wait for the installation to complete. When installation is over you will need to ensure that it has run successully and remove server from the maintenance mode.

To ensure that upgrade didn't mess anything up you will need to ensure that that all Exchange services are up and running by executing

Get-Service -Name *exchange* |ft -AutoSize

Make sure all the critical services are in the Started state

When all services are up and running and healthy, you are OK remove servers from the maintenance mode by restoring server's ability to send/receive email and to host active mailbox databases:

1. You activate server and its components and endpoints:

Set-ServerComponentState SERVER1 -Component ServerWideOffline -State Active -Requester Maintenance

2. You resume cluster (DAG) membership:

Resume-ClusterNode -Name SERVER1

3. You enable server to host active mailbox database copies again:

Set-MailboxServer SERVER1 -DatabaseCopyAutoActivationPolicy Unrestricted

Set-MailboxServer SERVER1 -DatabaseCopyActivationDisabledAndMoveNow $false

4 Finally you enable transport component on the server to send and receive emails:

Set-ServerComponentState E15MB1 –Component HubTransport –State Active –Requester Maintenance

After this you locate scripts folder and execute RedistributeActiveDatabases.ps1 to make sure that mailbox databases are redistributed according to their activation preference.

cd $exscripts

C:\Program Files\Microsoft\Exchange Server\V15\scripts>.\RedistributeActiveDatabases.ps1 -DagName DAG01 -BalanceDbsByActivationPreference -Confirm:$false

After servers are up and running we can do some more tests to ensure that installation and post-installation tasks have been successful:

1. Check if all services are healthy by executing Test-ServiceHealth

2. Check health of mailbox database copies located on the server Get-MailboxDatabaseCopyStatus (by default command defaults to the local server)

3. Check if replication is working by executing Test-ReplicationHealth

4. Check if nothing is left in maintenance mode by executing

Get-ServerComponentState -Identity SERVER1

Ensure that all the components have state of Active

After this you are OK to upgrade your other servers and operate the current one.


No comments:

Post a Comment