This script is needed when the server is out of maintenance mode but the component state is still INACTIVE. I've tested this on Exchange 2016 and Windows Server 2012 R2. Script canb eused for both DAG and non DAG Servers.

Follow the Blog post here - http://www.exchangeitpro.com/2014/08/07/exchange-server-2013-components-in-an-inactive-state/

<#
.NOTES
Written by Adnan Rafique @ExchangeITPro
V1.1 08.06.2014
.SYNOPSIS
Bring server componet to active state.
.DESCRIPTION
Bring component state to active state.
.PARAMETER Server
Specifies the DAG node Server name to be bring the component to active state. 
.EXAMPLE
PS> .\SetExchangeComponentToActive.ps1 -Server Server1
#>

#Requires -version 3.0

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true,
    HelpMessage="Enter the name of Server to set component to active.")]
    [string]$Server
)

#Designates that the server is out of maintenance mode and set the component to Active state
Set-ServerComponentState $Server -Component ServerWideOffline -State Active -Requester Functional
Set-ServerComponentState $Server -Component Monitoring -State Active -Requester Functional
Set-ServerComponentState $Server -Component RecoveryActionsEnabled -State Active -Requester Functional

#Get the status of component
Get-ServerComponentState $Server | ft Component,State -Autosize
Write-Host "$Server is now completely out of maintenance mode and component are active and functional." -ForegroundColor Yellow