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
----            ------  --------------- ----------------- --------------------   -----------------
DB01EX2013SRV1 Mounted 0               0                                        Healthy
DB02EX2013SRV1 Healthy 0               0                 15/10/2014 10:31:16 AM Healthy
DB03EX2013SRV1 Mounted 0               0                                        Healthy
DB04EX2013SRV1 Mounted 0               0                                        Healthy
DB02EX2013SRV2 Mounted 0               0                                        Healthy
DB01EX2013SRV2 Healthy 0               0                 15/10/2014 10:25:33 AM Healthy
DB03EX2013SRV2 Healthy 0               0                 15/10/2014 10:25:30 AM Healthy
DB04EX2013SRV2 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
----             ------ ------------- -------------------- -----------------
DB01EX2013SRV1 Mounted EX2013SRV1                       1           Healthy
DB03EX2013SRV1 Mounted EX2013SRV1                       1           Healthy
DB04EX2013SRV1 Mounted EX2013SRV1                       1           Healthy
DB02EX2013SRV2 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

[adrotate banner=”49″]

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. oluwaseun

    How do I get the command Get-MailboxDatabaseCopyStatus * | ft -auto to forward respond to my email

  2. Lauren Titus

    Is there a way to determine how many databases are replicating the same information across too many databases? I don’t want to sound too technical but a lot of small details like replication time can interfere with name changes or old forms that get handled by too many people who don’t have a good view of where to retrieve old records.

  3. Rustam

    Hi Paul,
    I have exchange 2013

    I don’t want to look at the properties of each account to see if they are using our first, Second or third database. Could you show me the command to list users in a specific database?

  4. Ahmed

    Hi Paul,

    we have exchange 2013 CU 10 with windows Server 2012. Since yesterday one of our exchange 2013 DAG member shows unavailable network in its DAG network details. Both MAPI and REPL networks are shown unavailable.

  5. pooja

    $_.Status -ne ‘Mounted’ can you guide me what does -ne means here in this command

    1. Avatar photo
      Paul Cunningham

      It’s a conditional operator that means “not equal”.

      So the command should return databases that do not have a status of “Mounted”.

  6. Andys

    can i do email forwarding on Distribution group to user’s mailbox?

  7. Javed

    To get the list of Active DB (Mounted) on a Exchange server, this is the command.

    Get-MailboxDatabaseCopyStatus -Server | Where-object { $_.status -eq “mounted”}

      1. Abul

        -Active switch will also give you the Dismounted DB. Which is not good for Backup Software.

  8. Adam Ovary

    HI,

    We need a powershell script to list ACTIVE database name but only on the local server. We need to say the ACTIVE database name for the backup software.

    1. David

      This will also work
      Get-MailboxDatabaseCopyStatus -server SERVERNAME | Where {$_.ActivationPreference -eq 1} | select Name,Status,CopyQueueLength,ReplayQueueLength,ContentIndexState | ft

  9. nithyanandham

    Hi Paul ,

    Thanks a lot for your response .

    S.Nithyanandham

  10. nithyanandham

    Hi Paul ,

    Does the below mentioned single command gives the list the active database copies in a database availability group, and show the mailbox server that they are active on for the environment which is having multiple no of DAG’S ?

    Get-MailboxDatabaseCopyStatus * | ft -auto

    1. Avatar photo
      Paul Cunningham

      It will return all database copies in the org, even for multiple DAGs.

  11. Sureshbabu

    Thanks for the clarification. Will post on any doubt in feature..

Leave a Reply