DAG Management CMDLETS

Home/Exchange Server/Exchange 2010/DAG Management CMDLETS

DAG Management CMDLETS

Get DAG Status
Get-DatabaseAvailabilityGroup EX10DAG1 -Status | fl

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

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

Find DatabaseCopyAutoActivationPolicy for all Servers
Get-MailboxServer | Sort-Object -Property DatabaseCopyAutoActivationPolicy | ft name,DatabaseCopyAutoActivationPolicy -AutoSize

Get Maintenance Status
Get-DatabaseAvailabilityGroup EX10DAG1 -Status | fl Servers, ServersInMaintenance

Get ALL Databases and Active Preference information NEAT
Get-MailboxDatabase | Sort Name | ft Name,ServerName,MountedOnServer, ActivationPreference -AutoSize

Get Databases sorted by Active Server
Get-MailboxDatabase | Sort-Object -Property MountedonServer | ft Name,ServerName,MountedOnServer, ActivationPreference -AutoSize

Get Number of Databases in DAG
(Get-MailboxDatabase).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 ‘EX10mbx08’ | fl name, server, activationpreference

Get Primary Active Manager (PAM)
Get-DatabaseAvailabilityGroup -Identity EX10DAG1 -Status | fl name,primaryactivemanager

Move PAM to another server
cluster.exe EX10DAG1.DOMAIN.ORG group “cluster group” /moveto:EX10SRV01

To block DB activation (switch site as needed)
Get-ExchangeServer | where { $_.Site -like ‘DOMAIN.ORG/Configuration/Sites/Site’ } | Get-MailboxServer | Set-MailboxServer –DatabaseCopyAutoActivationPolicy Blocked

Enable DAC Mode
Set-DatabaseAvailabilityGroup –identity “EX10DAG01” –DatacenterActivationMode DagOnly

Run RedistributeActiveDatabases.ps1 script to re-balance the active database copies across the DAG
.RedistributeActiveDatabases.ps1 -DagName EX10DAG1 -BalanceDbsByActivationPreference -ShowFinalDatabaseDistribution -Confirm:$false > DagConfig.txt

Get Primary Active Manager
get-databaseavailabilitygroup –identity EX10DAG1 –status | fl name,primaryActiveManager

Remove Server from Dag
Remove-DatabaseAvailabilityGroupServer -Identity EX10DAG1 -MailboxServer EX10SRV04

Add Server to DAG
ADD-DatabaseAvailabilityGroupServer -Identity EX10DAG1 -MailboxServer EX10SRV04

Unblock all databases hosted on a server
Set-MailboxServer –identity EX10SRV08 –DatabaseCopyAutoActivationPolicy Unrestricted

Block all databases hosted on Server
Set-MailboxServer –identity EX10SRV14 –DatabaseCopyAutoActivationPolicy Blocked

Set Mailbox Database Copy Activation Copy
Set-MailboxDatabaseCopy -Identity EX10MBX02EX10SRV02 -ActivationPreference 1

To block a database copy from getting activated automatically
Suspend-MailboxDatabaseCopy –identity EX10mbx01EX10SRV03 –ActivationOnly

To reverse the unblock process
Resume-MailboxDatabaseCopy –identity EX10mbx04EX10SRV13

Please feel free to share.
By | 2013-07-14T00:50:49+00:00 July 14th, 2013|Exchange 2010, Exchange Server|0 Comments

About the Author:

Leave A Comment