Exchange 2013: In place upgrade places components in an offline state.
In Exchange 2013 we introduced the concept of server component states. This allows administrators a great deal of flexibility to control a server’s ability to service certain requests either partially or fully. More information on server component states can be found here.
Normally when applying a cumulative update to an Exchange 2013 instance the server would be put into maintenance mode. Maintenance mode usually involves two separate commands:
- Executing the StartDagServerMaintenance.ps1 script.
- Setting all the component states on a given server to server wide offline.
- Disabling automatic recovery actions on the server.
This effectively migrates all functionality off of the server ensuring that maintenance can be safely performed. In Exchange 2013, we have also extended setup to perform some of the maintenance tasks prescribed here – specifically handling server health states to ensure that the server can be safely upgraded. When performing setup.exe /mode:upgrade to upgrade between Exchange 2013 CUs we now perform the following:
- Set the monitoring state of the server to inactive.
- Prevent automatic recovery actions from occurring on the server.
- Set the ServerWideOffline component state to InActive
This essentially disables all health checking against the server, all automatic recovery actions as a result of that health checking, and prevents the server from performing transport and other client functions.
Let’s examine a sample upgrade.
Prior to running setup.exe /mode:upgrade get-servercomponentstate can be executed. In almost all cases the components show active:
[PS] C:\>Get-ServerComponentState -Identity MBX-TEST
Server Component State
------ --------- -----
MBX-TEST.exchange.msft ServerWideOffline Active
MBX-TEST.exchange.msft HubTransport Active
MBX-TEST.exchange.msft FrontendTransport Active
MBX-TEST.exchange.msft Monitoring Active
MBX-TEST.exchange.msft RecoveryActionsEnabled Active
MBX-TEST.exchange.msft AutoDiscoverProxy Active
MBX-TEST.exchange.msft ActiveSyncProxy Active
MBX-TEST.exchange.msft EcpProxy Active
MBX-TEST.exchange.msft EwsProxy Active
MBX-TEST.exchange.msft ImapProxy Active
MBX-TEST.exchange.msft OabProxy Active
MBX-TEST.exchange.msft OwaProxy Active
MBX-TEST.exchange.msft PopProxy Active
MBX-TEST.exchange.msft PushNotificationsProxy Active
MBX-TEST.exchange.msft RpsProxy Active
MBX-TEST.exchange.msft RwsProxy Active
MBX-TEST.exchange.msft RpcProxy Active
MBX-TEST.exchange.msft UMCallRouter Active
MBX-TEST.exchange.msft XropProxy Active
MBX-TEST.exchange.msft HttpProxyAvailabilityGroup Active
MBX-TEST.exchange.msft ForwardSyncDaemon Active
MBX-TEST.exchange.msft ProvisioningRps Active
MBX-TEST.exchange.msft MapiProxy Active
MBX-TEST.exchange.msft EdgeTransport Active
MBX-TEST.exchange.msft HighAvailability Active
MBX-TEST.exchange.msft SharedCache Active
At this time we execute the setup.exe /mode:upgrade. A review of the setup log shows that we are building commands to execute to adjust the server component state and disable server health checking.
[10/14/2014 17:30:59.0886] [1] Executing:
try
{
$Target = $env:COMPUTERNAME
try
{
$exSrv = get-ExchangeServer $Target -ErrorAction SilentlyContinue
}
catch
{
Write-ExchangeSetupLog -Warning "Unable to set monitoring and server state to inactive. Setup will continue.";
}
if ($exSrv -eq $null)
{
Write-ExchangeSetupLog -Warning "$Target is not an Exchange Server. Unable to set monitoring and server state to inactive. Setup will continue.";
return
}
Set-ServerComponentState $Target -Component Monitoring -Requester Functional -State Inactive
Write-ExchangeSetupLog -Info "Monitoring has been set to Inactive while setup is running."
Set-ServerComponentState $Target -Component RecoveryActionsEnabled -Requester Functional -State Inactive
Write-ExchangeSetupLog -Info "RecoveryActionsEnabled has been set to Inactive while setup is running."
Set-ServerComponentState $Target -Component ServerWideOffline -Requester Functional -State InActive
Write-ExchangeSetupLog -Info "The server state has been set to Inactive while setup is running."
}
catch
{
Write-ExchangeSetupLog -Warning "Unable to set monitoring and server state to inactive. Setup can not continue.";
throw;
}
After the commands are built the setup routine executes them. It should be noted that these steps are executed directly at the beginning of setup – even before pre-requisite analysis etc.
[10/14/2014 17:31:00.0510] [2] Active Directory session settings for 'Set-ServerComponentState' are: View Entire Forest: 'True', Configuration Domain Controller: 'DC-TEST.exchange.msft', Preferred Global Catalog: 'DC-TEST.exchange.msft', Preferred Domain Controllers: '{ DC-TEST.exchange.msft }'
[10/14/2014 17:31:00.0510] [2] User specified parameters: -Component:'Monitoring' -Requester:'Functional' -State:'Inactive' -Identity:'MBX-TEST'
[10/14/2014 17:31:00.0510] [2] Beginning processing Set-ServerComponentState
[10/14/2014 17:31:02.0339] [2] Ending processing Set-ServerComponentState
[10/14/2014 17:31:02.0354] [2] Beginning processing Write-ExchangeSetupLog
[10/14/2014 17:31:02.0354] [2] Monitoring has been set to Inactive while setup is running.
[10/14/2014 17:31:02.0354] [2] Ending processing Write-ExchangeSetupLog
[10/14/2014 17:31:02.0354] [2] Active Directory session settings for 'Set-ServerComponentState' are: View Entire Forest: 'True', Configuration Domain Controller: 'DC-TEST.exchange.msft', Preferred Global Catalog: 'DC-TEST.exchange.msft', Preferred Domain Controllers: '{ DC-TEST.exchange.msft }'
[10/14/2014 17:31:02.0354] [2] User specified parameters: -Component:'RecoveryActionsEnabled' -Requester:'Functional' -State:'Inactive' -Identity:'MBX-TEST'
[10/14/2014 17:31:02.0354] [2] Beginning processing Set-ServerComponentState
[10/14/2014 17:31:02.0589] [2] Ending processing Set-ServerComponentState
[10/14/2014 17:31:02.0589] [2] Beginning processing Write-ExchangeSetupLog
[10/14/2014 17:31:02.0589] [2] RecoveryActionsEnabled has been set to Inactive while setup is running.
[10/14/2014 17:31:02.0589] [2] Ending processing Write-ExchangeSetupLog
[10/14/2014 17:31:02.0589] [2] Active Directory session settings for 'Set-ServerComponentState' are: View Entire Forest: 'True', Configuration Domain Controller: 'DC-TEST.exchange.msft', Preferred Global Catalog: 'DC-TEST.exchange.msft', Preferred Domain Controllers: '{ DC-TEST.exchange.msft }'
[10/14/2014 17:31:02.0589] [2] User specified parameters: -Component:'ServerWideOffline' -Requester:'Functional' -State:'Inactive' -Identity:'MBX-TEST'
[10/14/2014 17:31:02.0589] [2] Beginning processing Set-ServerComponentState
[10/14/2014 17:31:02.0761] [2] Ending processing Set-ServerComponentState
[10/14/2014 17:31:02.0761] [2] Beginning processing Write-ExchangeSetupLog
[10/14/2014 17:31:02.0761] [2] The server state has been set to Inactive while setup is running.
During setup running get-servercomponentstate reflects that all components are set to inactive.
[PS] C:\>Get-ServerComponentState -Identity MBX-TEST
Server Component State
------ --------- -----
MBX-TEST.exchange.msft ServerWideOffline Inactive
MBX-TEST.exchange.msft HubTransport Inactive
MBX-TEST.exchange.msft FrontendTransport Inactive
MBX-TEST.exchange.msft Monitoring Inactive
MBX-TEST.exchange.msft RecoveryActionsEnabled Inactive
MBX-TEST.exchange.msft AutoDiscoverProxy Inactive
MBX-TEST.exchange.msft ActiveSyncProxy Inactive
MBX-TEST.exchange.msft EcpProxy Inactive
MBX-TEST.exchange.msft EwsProxy Inactive
MBX-TEST.exchange.msft ImapProxy Inactive
MBX-TEST.exchange.msft OabProxy Inactive
MBX-TEST.exchange.msft OwaProxy Inactive
MBX-TEST.exchange.msft PopProxy Inactive
MBX-TEST.exchange.msft PushNotificationsProxy Inactive
MBX-TEST.exchange.msft RpsProxy Inactive
MBX-TEST.exchange.msft RwsProxy Inactive
MBX-TEST.exchange.msft RpcProxy Inactive
MBX-TEST.exchange.msft UMCallRouter Inactive
MBX-TEST.exchange.msft XropProxy Inactive
MBX-TEST.exchange.msft HttpProxyAvailabilityGroup Inactive
MBX-TEST.exchange.msft ForwardSyncDaemon Inactive
MBX-TEST.exchange.msft ProvisioningRps Inactive
MBX-TEST.exchange.msft MapiProxy Inactive
MBX-TEST.exchange.msft EdgeTransport Inactive
MBX-TEST.exchange.msft HighAvailability Inactive
MBX-TEST.exchange.msft SharedCache Inactive
In almost all cases this is very helpful as it helps to ensure that the server is not actively servicing clients or subject to healthy monitoring while services may be in a disabled or upgrading state. Where this can cause issues though – what happens if setup fails? For example, recently a customer presented a case where the pre-requisite tests were failing. The fix for the pre-requisite could not be immediately acted on so the customer deferred the action to another maintenance window. They then discovered that the components remained in an inactive state meaning the server was not fully functional. To the customer this was unexpected – to support this was fully expected. As previously indicated the component states are adjusted very early in setup, therefore if any actions during setup fail the components remain inactive. When setups completes successfully the component states are reverted.
In this example I have executed setup.exe /mode:upgrade from the command line. During the pre-requisite analysis I performed a CTRL-C to cause setup to abort.
PS C:\CU6> .\setup.exe /mode:upgrade /iacceptExchangeServerLicenseTerms
Welcome to Microsoft Exchange Server 2013 Cumulative Update 6 Unattended Setup
Copying Files...
File copy complete. Setup will now collect additional information needed for installation.
Languages
Mailbox role: Transport service
Client Access role: Front End Transport service
Mailbox role: Client Access service
Mailbox role: Unified Messaging service
Mailbox role: Mailbox service
Management tools
Client Access role: Client Access Front End service
Performing Microsoft Exchange Server Prerequisite Check
Configuring Prerequisites COMPLETED
Prerequisite Analysis 84%
When this was completed I gathered the component states and noted they continue to remain inactive.
[PS] C:\>Get-ServerComponentState -Identity MBX-TEST
Server Component State
------ --------- -----
MBX-TEST.exchange.msft ServerWideOffline Inactive
MBX-TEST.exchange.msft HubTransport Inactive
MBX-TEST.exchange.msft FrontendTransport Inactive
MBX-TEST.exchange.msft Monitoring Inactive
MBX-TEST.exchange.msft RecoveryActionsEnabled Inactive
MBX-TEST.exchange.msft AutoDiscoverProxy Inactive
MBX-TEST.exchange.msft ActiveSyncProxy Inactive
MBX-TEST.exchange.msft EcpProxy Inactive
MBX-TEST.exchange.msft EwsProxy Inactive
MBX-TEST.exchange.msft ImapProxy Inactive
MBX-TEST.exchange.msft OabProxy Inactive
MBX-TEST.exchange.msft OwaProxy Inactive
MBX-TEST.exchange.msft PopProxy Inactive
MBX-TEST.exchange.msft PushNotificationsProxy Inactive
MBX-TEST.exchange.msft RpsProxy Inactive
MBX-TEST.exchange.msft RwsProxy Inactive
MBX-TEST.exchange.msft RpcProxy Inactive
MBX-TEST.exchange.msft UMCallRouter Inactive
MBX-TEST.exchange.msft XropProxy Inactive
MBX-TEST.exchange.msft HttpProxyAvailabilityGroup Inactive
MBX-TEST.exchange.msft ForwardSyncDaemon Inactive
MBX-TEST.exchange.msft ProvisioningRps Inactive
MBX-TEST.exchange.msft MapiProxy Inactive
MBX-TEST.exchange.msft EdgeTransport Inactive
MBX-TEST.exchange.msft HighAvailability Inactive
MBX-TEST.exchange.msft SharedCache Inactive
In this case if no action was taken these states would be maintained until:
- The administrator completed the setup operation.
- The administrator reverted the component states.
In this case the administrator reverted the component states by performing the following actions:
- Set-ServerComponentState <SERVER> –component Monitoring –requester Functional –state Active
- Set-ServerComponentState <SERVER> –component RecoveryActionsEnabled –requestor Functional –state Active
- Set-ServerComponentState <SERVER> –component ServerWideOffline –requestor Functional –state Active
This combined with StopDagServerMaintenance.ps1 (if utilized) would revert the maintenance actions performed by both the administrator and automatically by setup.
Had the administrator allowed setup to complete successfully these actions would have been reverted automatically upon successful completion of setup. In this instance the setup was successful:
PS C:\CU6> .\setup.exe /mode:upgrade /iacceptExchangeServerLicenseTerms
Welcome to Microsoft Exchange Server 2013 Cumulative Update 6 Unattended Setup
Copying Files...
File copy complete. Setup will now collect additional information needed for installation.
Languages
Mailbox role: Transport service
Client Access role: Front End Transport service
Mailbox role: Client Access service
Mailbox role: Unified Messaging service
Mailbox role: Mailbox service
Management tools
Client Access role: Client Access Front End service
Performing Microsoft Exchange Server Prerequisite Check
Configuring Prerequisites COMPLETED
Prerequisite Analysis COMPLETED
Setup can't detect a Send connector with an address space of '*'. Mail flow to the Internet may not work properly.
For more information, visit: https://technet.microsoft.com/library(EXCHG.150)/ms.exch.setupreadiness.NoConnectorToStar.aspx
Configuring Microsoft Exchange Server
Organization Preparation COMPLETED
Preparing Setup COMPLETED
Stopping Services COMPLETED
Language Files COMPLETED
Removing Exchange Files COMPLETED
Preparing Files COMPLETED
Copying Exchange Files COMPLETED
Language Files COMPLETED
Restoring Services COMPLETED
Language Configuration COMPLETED
Mailbox role: Transport service COMPLETED
Client Access role: Front End Transport service COMPLETED
Mailbox role: Client Access service COMPLETED
Mailbox role: Unified Messaging service COMPLETED
Mailbox role: Mailbox service COMPLETED
Exchange Management Tools COMPLETED
Client Access role: Client Access Front End service COMPLETED
Finalizing Setup COMPLETED
The Exchange Server setup operation completed successfully.
When reviewing the server component states it is observed that everything is active:
[PS] C:\>Get-ServerComponentState -Identity MBX-TEST
Server Component State
------ --------- -----
MBX-TEST.exchange.msft ServerWideOffline Active
MBX-TEST.exchange.msft HubTransport Active
MBX-TEST.exchange.msft FrontendTransport Active
MBX-TEST.exchange.msft Monitoring Active
MBX-TEST.exchange.msft RecoveryActionsEnabled Active
MBX-TEST.exchange.msft AutoDiscoverProxy Active
MBX-TEST.exchange.msft ActiveSyncProxy Active
MBX-TEST.exchange.msft EcpProxy Active
MBX-TEST.exchange.msft EwsProxy Active
MBX-TEST.exchange.msft ImapProxy Active
MBX-TEST.exchange.msft OabProxy Active
MBX-TEST.exchange.msft OwaProxy Active
MBX-TEST.exchange.msft PopProxy Active
MBX-TEST.exchange.msft PushNotificationsProxy Active
MBX-TEST.exchange.msft RpsProxy Active
MBX-TEST.exchange.msft RwsProxy Active
MBX-TEST.exchange.msft RpcProxy Active
MBX-TEST.exchange.msft UMCallRouter Active
MBX-TEST.exchange.msft XropProxy Active
MBX-TEST.exchange.msft HttpProxyAvailabilityGroup Active
MBX-TEST.exchange.msft ForwardSyncDaemon Active
MBX-TEST.exchange.msft ProvisioningRps Active
MBX-TEST.exchange.msft MapiProxy Active
MBX-TEST.exchange.msft EdgeTransport Active
MBX-TEST.exchange.msft HighAvailability Active
MBX-TEST.exchange.msft SharedCache Active
In the setup log it is observed that the setup routine constructs the correct commands to reverse the inactive setting.
[10/14/2014 19:45:47.0400] [1] Executing:
$Target = $env:COMPUTERNAME
$expectSrv = $true
$Error.Clear()
try
{
$exSrv = get-ExchangeServer $Target -ErrorAction Stop
}
catch
{
if ($Error.Exception.GetType().Name -eq 'ManagementObjectNotFoundException')
{
$expectSrv = $false;
Write-ExchangeSetupLog -Warning "$Target is not an Exchange Server. Unable to set monitoring and server state to active. Setup will continue.";
}
else
{
Write-ExchangeSetupLog -Error "SetServerStateForSetup fails for $Target due to $Error";
}
}
if ($exSrv -eq $null)
{
if (!$expectSrv)
{
return
}
throw "SetServerStateForSetup fails due to $Error";
}
Set-ServerComponentState $Target -Component Monitoring -Requester Functional -State Active
Write-ExchangeSetupLog -Info "Install is complete. Monitoring has been set to Active.";
Set-ServerComponentState $Target -Component RecoveryActionsEnabled -Requester Functional -State Active
Write-ExchangeSetupLog -Info "Install is complete. RecoveryActionsEnabled has been set to Active.";
Set-ServerComponentState $Target -Component ServerWideOffline -Requester Functional -State Active
Write-ExchangeSetupLog -Info "Install is complete. Server state has been set to Active.";
These commands are then executed at the end of setup during finalization.
[10/14/2014 19:45:47.0854] [2] Active Directory session settings for 'Set-ServerComponentState' are: View Entire Forest: 'True', Configuration Domain Controller: 'DC-TEST.exchange.msft', Preferred Global Catalog: 'DC-TEST.exchange.msft', Preferred Domain Controllers: '{ DC-TEST.exchange.msft }'
[10/14/2014 19:45:47.0854] [2] User specified parameters: -Component:'Monitoring' -Requester:'Functional' -State:'Active' -Identity:'MBX-TEST'
[10/14/2014 19:45:47.0854] [2] Beginning processing Set-ServerComponentState
[10/14/2014 19:45:48.0166] [2] Ending processing Set-ServerComponentState
[10/14/2014 19:45:48.0182] [2] Beginning processing Write-ExchangeSetupLog
[10/14/2014 19:45:48.0182] [2] Install is complete. Monitoring has been set to Active.
[10/14/2014 19:45:48.0182] [2] Ending processing Write-ExchangeSetupLog
[10/14/2014 19:45:48.0182] [2] Active Directory session settings for 'Set-ServerComponentState' are: View Entire Forest: 'True', Configuration Domain Controller: 'DC-TEST.exchange.msft', Preferred Global Catalog: 'DC-TEST.exchange.msft', Preferred Domain Controllers: '{ DC-TEST.exchange.msft }'
[10/14/2014 19:45:48.0182] [2] User specified parameters: -Component:'RecoveryActionsEnabled' -Requester:'Functional' -State:'Active' -Identity:'MBX-TEST'
[10/14/2014 19:45:48.0182] [2] Beginning processing Set-ServerComponentState
[10/14/2014 19:45:48.0620] [2] Ending processing Set-ServerComponentState
[10/14/2014 19:45:48.0620] [2] Beginning processing Write-ExchangeSetupLog
[10/14/2014 19:45:48.0635] [2] Install is complete. RecoveryActionsEnabled has been set to Active.
[10/14/2014 19:45:48.0635] [2] Ending processing Write-ExchangeSetupLog
[10/14/2014 19:45:48.0635] [2] Active Directory session settings for 'Set-ServerComponentState' are: View Entire Forest: 'True', Configuration Domain Controller: 'DC-TEST.exchange.msft', Preferred Global Catalog: 'DC-TEST.exchange.msft', Preferred Domain Controllers: '{ DC-TEST.exchange.msft }'
[10/14/2014 19:45:48.0635] [2] User specified parameters: -Component:'ServerWideOffline' -Requester:'Functional' -State:'Active' -Identity:'MBX-TEST'
[10/14/2014 19:45:48.0635] [2] Beginning processing Set-ServerComponentState
[10/14/2014 19:45:48.0870] [2] Ending processing Set-ServerComponentState
[10/14/2014 19:45:48.0870] [2] Beginning processing Write-ExchangeSetupLog
[10/14/2014 19:45:48.0870] [2] Install is complete. Server state has been set to Active.
[10/14/2014 19:45:48.0870] [2] Ending processing Write-ExchangeSetupLog
When the setup routine completes successfully the inactive states are correctly reset. Should an error occur anytime after setup is initialized, and setup has not completed, it may be necessary for the administrator to manually revert these settings.
Comments
- Anonymous
January 01, 2003
Thanks for your answer, Tim
You're right, it takes time to drain the transport queues, and it actually requires a service restart to initiate draining
So, if setup fails and leaves the Exchange server in an unhealthy state, it means data could eventually be stuck in the queue databases until the problem is fixed. Am I right?
If so, what should be the workaround?
If we set the transport services in a draining state before updating the server, will the setup continue? (According to the commands built by the setup process, it should work) - Anonymous
January 01, 2003
@Me...
That is correct and why this case was raised. Setup for example was cancelled but the server was not servicing clients etc.
TIMMCMIC - Anonymous
January 01, 2003
The comment has been removed - Anonymous
January 01, 2003
@Me...
Glad you enjoyed it.
TIMMCMIC - Anonymous
January 01, 2003
@Erik:
Thanks for taking the time to post a comment. Without looking at the logs specifically I do not have any immediate insight.
TIMMCMIC - Anonymous
January 01, 2003
@Cedric...
So I don't play a setup engineer during the say but if I had to guess - setup moves through the procedures very quickly. The draining / redirect process takes time - it also in some instances requires a restart of the transport service if my understanding is correct. So if I had to guess - i'd suggest timing.
TIMMCMIC - Anonymous
October 21, 2014
not missing any posts:)
didn't know about this:"we have also extended setup to perform some of the maintenance tasks prescribed here "
Thanks Tim always eye opening and interesting - Anonymous
October 22, 2014
always:)
anyway silly question(I think I know answer I just never checked)
if it marks MA marks it as down/unavailable does that mean it already set the services to down(I think no)
and if not then the server would be unavailable to users right?(even though services are still up and not disabled)I think Yes
jut want to be sure - Anonymous
October 28, 2014
thanks for clearing that up - Anonymous
January 14, 2015
Great write up. There is one thing I don't get, after installing Windows Updates and rebooting the computer the Healthstate of the PopProxy remains Inactive, we have to manually set it to Active. What's up with that? - Anonymous
April 02, 2015
The comment has been removed - Anonymous
August 22, 2015
@Jeff...
Please keep your comments appropriate and to the subject matter contained in the blog. Comment removed.
TIMMCMIC