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 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 EX10MBX02\EX10SRV02 -ActivationPreference 1

To block a database copy from getting activated automatically
Suspend-MailboxDatabaseCopy –identity EX10mbx01\EX10SRV03 –ActivationOnly

To reverse the unblock process
Resume-MailboxDatabaseCopy –identity EX10mbx04\EX10SRV13

Categories: Exchange 2010, Exchange Server

Tags: , , , , , , , , ,

We look forward to hearing your feedback..

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: