Exchange Server 2010 – Failover and Maintenance


Database status

  • PS C:\> Get-DatabaseAvailabilityGroup
  • PS C:\> Get-MailboxDatabase -Status | select Identity,MountedOnServer,ActivationPreference,MasterServerOrAvailabilityGroup,MaintenanceSchedule

Quorum check/move

  • PS C:\> Cluster DAG1 group
  • PS C:\> Cluster group "cluster group" /status
  • PS C:\> Cluster group "cluster group" /move

Database status through organization

  • PS C:\> Get-MailboxServer | Get-MailboxDatabaseCopyStatus
  • PS C:\> (Get-MailboxDatabase | Get-MailboxDatabaseCopyStatus | where {$_.Status -eq "Mounted"}).Count


Managing Database Availability Groups

Before performing any type of software or hardware maintenance on a DAG member, you should first remove the DAG member from service by using the StartDagServerMaintenance.ps1 script (just find Exchange Scripts directory for example“D:\Exchange Server\Scripts”). This script moves all the active databases off the server and blocks active databases from moving to that server. The script also ensures that all critical DAG support functionality that may be on the server (for example, the Primary Active Manager (PAM) role) is moved to another server and blocked from moving back to the server. Specifically, the StartDagServerMaintenance.ps1 script performs the following tasks:

  • Runs Suspend-MailboxDatabaseCopy with the ActivationOnly parameter to suspend each database copy hosted on the DAG member for activation.
  • Pauses the node in the cluster, which prevents the node from being and becoming the PAM.
  • Sets the value of the DatabaseCopyAutoActivationPolicy parameter on the DAG member to Blocked.
  • Moves all active databases currently hosted on the DAG member to other DAG members.
  • If the DAG member currently owns the default cluster group, the script moves the default cluster group (and therefore the PAM role) to another DAG member.
  • If any of the preceding tasks fails, all operations, except for successful database moves, are undone.

After the maintenance is complete and the DAG member is ready to return to service, you can use the StopDagServerMaintenance.ps1 script to take the DAG member out of maintenance mode and put it back into production. Specifically, the StopDagServerMaintenance.ps1 script performs the following tasks:

  • Runs the Resume-MailboxDatabaseCopy cmdlet for each database copy hosted on the DAG member.
  • Resumes the node in the cluster, which enables full cluster functionality for the DAG member.
  • Sets the value of the DatabaseCopyAutoActivationPolicy parameter on the DAG member to Unrestricted.
  • Both scripts accept the -ServerName parameter (which can be either the host name or the fully qualified domain name (FQDN) of the DAG member) and the -WhatIf parameter. Both scripts can be run locally or remotely. The server on which the scripts are executed must have the Windows Failover Cluster Management tools installed (RSAT-Clustering).

Installing Update Rollups on DAG Members:

  1. Use the StartDagServerMaintenance.ps1 script to put the DAG member in maintenance mode.
  2. Install the update rollup.
  3. Use the StopDagServerMaintenance.ps1 script to take the DAG member out of maintenance mode and put it back into production.
  4. Use the RedistributeActiveDatabases.ps1 script to rebalance the active database copies across the DAG.
  • 1. PS C:\>.\StartDagServerMaintenance.ps1 –serverName MbxServer01
  • 2. PS C:\> Restart-Computer
  • 3. PS C:\>.\StopDagServerMaintenance.ps1 –serverName MbxServer01
  • 4. PS C:\>.\RedistributeActiveDatabases.ps1 -DagName DAG01 –BalanceDbsByActivationPreferenc

Switchover Server

  • PS C:\> Move-ActiveMailboxDatabase -Server MbxServer01
  • PS C:\> Move-ActiveMailboxDatabase -Server MbxServer01 -ActivateOnServer MbxServer02 -MountDialOverride lossless

Switchover Active Database

  • PS C:\> Move-ActiveMailboxDatabase DB01 -ActivateOnServer MbxServer02 -MountDialOverride lossless

Cannot Activate Database Copy – Content Index Catalog Files in Failed State:

  • PS C:\> Update-MailboxDatabaseCopy "DB01\MbxServer01" –CatalogOnly

How to Reseed a Failed Mailbox Database Copy in Exchange Server 2010:

  • PS C:\> Suspend-MailboxDatabaseCopy -Identity "DB01\MbxServer01"
  • PS C:\> Update-MailboxDatabaseCopy -Identity "DB01\ MbxServer01" -DeleteExistingFiles




  • PS C:\> Test-ServiceHealth
  • PS C:\> Test-Mailflow -TargetDatabase MbxServer02
  • PS C:\> Test-ReplicationHealth


You can use built-in test account or an account $cred=Get-Credential fici\admin:
You must create a test account before you can diagnose Availability service issues using the Test-OutlookWebServices cmdlet. To create the test mailbox, log on to the Exchange Server 2007 or Exchange 2010 Mailbox server. Open the Shell, and then locate the Scripts directory under the installation path on the Exchange server. For Exchange 2007, the folder is located at C:\Program Files\Microsoft\Exchange Server\Scripts, where C:\ is the directory to which you installed Exchange. For Exchange 2010, the folder is located at C:\Program Files\Microsoft\ExchangeServer\V14\Scripts, where C:\ is the directory to which you installed Exchange 2010. Run the script New-TestCasConnectivityUser.ps1. Repeat this process on each Exchange 2007 or Exchange 2010 Mailbox server that is to be tested.

Related issue solved here: Mailbox could not be created. Verify that OU (Users) exists and that password meets complexity requirements…

  • PS C:\> Test-ServiceHealth
  • PS C:\> Test-WebServicesConnectivity -MailboxCredential $cred OR Test-WebServicesConnectivity
  • PS C:\> Test-OwaConnectivity -MailboxCredential $cred -url ""
  • PS C:\> Test-ActiveSyncConnectivity -MailboxCredential $cred -URL
  • PS C:\> Test-MAPIConnectivity


  • PS C:\> Test-ServiceHealth
  • PS C:\> Get-TransportServer|Get-Queue|fl Identity,Status,MessageCount

 CHECK & REPORT provides us two great scripts for health check/report.

  1. PowerShell Script to Generate a Health Check Report for Exchange Server 2010 – Test-ExchangeServerHealth.ps1
  2. How to Health Check an Exchange 2010 Mailbox Server – Test-MailboxServer.ps1