Get DAG Status

Get-DatabaseAvailabilityGroup {DAG NAME} -Status | fl

StartDagServerMaintenance.ps1 script to put the DAG member in maintenance mode

 .\StartDagServerMaintenance.ps1 -serverName {DAG NAME}

StopDagServerMaintenance.ps1 script to take the DAG member out of maintenance mode

.\StopDagServerMaintenance.ps1 -serverName {DAG NAME}

Find DatabaseCopyAutoActivationPolicy for all Servers

Get-MailboxServer | Sort-Object -Property  DatabaseCopyAutoActivationPolicy | ft name,DatabaseCopyAutoActivationPolicy -AutoSize

Get Maintenance Status

Get-DatabaseAvailabilityGroup {DAG NAME} -Status | fl Servers, ServersInMaintenance

Get ALL Databases and Active Preference information NEAT

Get-MailboxDatabase | Sort Name | ft Name,ActivationPreference -AutoSize

Get total number of Databases in Organzation

(Get-MailboxDatabase | Sort-Object -Property  Servername Name | ft Name,ServerName,MountedOnServer, ActivationPreference).count

Get All databases and Activation Preference information

Get-MailboxDatabase | ft name, server, activationpreference -AutoSize

Get Specific databases and Activation Preference information

Get-MailboxDatabase -Identity {DB Name} | fl name, server, activationpreference

Get Primary Active Manager (PAM)

Get-DatabaseAvailabilityGroup -Identity {DAG NAME} -Status | fl name,primaryactivemanager

Move PAM to another server

cluster.exe { group “cluster group” /moveto:{servername}

To block DB activation (switch site as needed)

Get-ExchangeServer | where { $_.Site -like ‘{’ } | Get-MailboxServer | Set-MailboxServer –DatabaseCopyAutoActivationPolicy Blocked

Enable DAC Mode

Set-DatabaseAvailabilityGroup –identity “{DAG NAME}” –DatacenterActivationMode DagOnly

Run RedistributeActiveDatabases.ps1 script to re-balance the active database copies across the DAG

.\RedistributeActiveDatabases.ps1 -DagName {DAG NAME} -BalanceDbsByActivationPreference -ShowFinalDatabaseDistribution -Confirm:$false > DagConfig.txt

Get Primary Active Manager

get-databaseavailabilitygroup –identity {DAG NAME} –status | fl name,primaryActiveManager

Remove Server from Dag

Remove-DatabaseAvailabilityGroupServer -Identity {DAG NAME} -MailboxServer EXCHM01

Add Server to DAG

ADD-DatabaseAvailabilityGroupServer -Identity {DAG NAME} -MailboxServer EXCHM04

Unblock all databases hosted on a server

Set-MailboxServer –identity {ServerName} –DatabaseCopyAutoActivationPolicy Unrestricted

Block all databases hosted on Server

Set-MailboxServer –identity {ServerName} –DatabaseCopyAutoActivationPolicy Blocked

Set Mailbox Database Copy Activation Copy

Set-MailboxDatabaseCopy -Identity {DB Name}\{ServerName} -ActivationPreference 1

To block a database copy from getting activated automatically

Suspend-MailboxDatabaseCopy –identity {DB Name}\{ServerName} –ActivationOnly