Quantcast
Channel: Practical 365
Viewing all articles
Browse latest Browse all 546

PowerShell Tip: List Active Mailbox Database Copies for an Exchange Server Database Availability Group

$
0
0

A reader asks whether it is possible to run a PowerShell command to list the active database copies in a database availability group, and show the mailbox server that they are active on.

He’s already discovered the Get-MailboxDatabaseCopyStatus cmdlet, but the default output does not include the specific information he wants to see.

[PS] C:\>Get-MailboxDatabaseCopyStatus * | ft -auto
Name            Status  CopyQueueLength ReplayQueueLength LastInspectedLogTime   ContentIndexState
----            ------  --------------- ----------------- --------------------   -----------------
DB01\EX2013SRV1 Mounted 0               0                                        Healthy
DB02\EX2013SRV1 Healthy 0               0                 15/10/2014 10:31:16 AM Healthy
DB03\EX2013SRV1 Mounted 0               0                                        Healthy
DB04\EX2013SRV1 Mounted 0               0                                        Healthy
DB02\EX2013SRV2 Mounted 0               0                                        Healthy
DB01\EX2013SRV2 Healthy 0               0                 15/10/2014 10:25:33 AM Healthy
DB03\EX2013SRV2 Healthy 0               0                 15/10/2014 10:25:30 AM Healthy
DB04\EX2013SRV2 Healthy 0               0                 15/10/2014 10:27:34 AM Healthy

The information he is looking for can be retrieved using Get-MailboxDatabaseCopyStatus, we just need to use Select-Object to return different attributes than the default output displays.

Let’s say you wanted to see:

  • Active mailbox database copies only, and their status for good measure
  • The mailbox server they are active on (even though this is already in the name of the DB copy we’ll grab it separately as well)
  • The activation preference of that database copy
  • The content index state

To see all of that we can run this command:

[PS] C:\>Get-MailboxDatabaseCopyStatus * -Active | Select Name,Status,MailboxServer,ActivationPreference,ContentIndexState
Name             Status MailboxServer ActivationPreference ContentIndexState
----             ------ ------------- -------------------- -----------------
DB01\EX2013SRV1 Mounted EX2013SRV1                       1           Healthy
DB03\EX2013SRV1 Mounted EX2013SRV1                       1           Healthy
DB04\EX2013SRV1 Mounted EX2013SRV1                       1           Healthy
DB02\EX2013SRV2 Mounted EX2013SRV2                       1           Healthy

If you’re curious about other attributes that can also be viewed simply use Get-Member to list them all.

[PS] C:\>Get-MailboxDatabaseCopyStatus | Get-Member

This article PowerShell Tip: List Active Mailbox Database Copies for an Exchange Server Database Availability Group is © 2014 ExchangeServerPro.com

Get more Exchange Server tips at ExchangeServerPro.com

     

Viewing all articles
Browse latest Browse all 546

Trending Articles