How to Use Get-MailboxDatabaseCopyStatus Command?

Summary: In this post, we’ve explained the parameters that are used in Get-MailboxDatabaseCopyStatus command. We’ve also explained the process to use the Get-MailboxDatabaseCopyStatus command. Also, you’ll find about an Exchange recovery tool that can help you recover Exchange database if anything goes wrong.


How to Use Get-MailboxDatabaseCopyStatus Command?

Exchange Server is a great tool of collaboration. But it also needs some maintenance from time-to-time. In this post, we will not be discussing the whole maintenance process but rather on one of the options, especially when having a Database Availability Group (DAG). We must ensure that the databases are synchronized between the active copy and passive copy so that if something happens to the main site, there will be no data loss or surprises when disaster strikes or when we have allocated a maintenance window to install updates, upgrade hardware, or maintain hardware.

The PowerShell cmdlet Get-MailboxDatabaseCopyStatus can provide the status of the information of the synchronization between the copies and the health of the connection of one or more databases. This PowerShell cmdlet applies to Exchange Server 2010, 2013, 2016, and 2019.

Below is the syntax of the Get-MailboxDatabaseCopyStatus.

Get-MailboxDatabaseCopyStatus
   -Server <MailboxServerIdParameter>
   [-Active]
   [-DomainController <Fqdn>]
   [-ExtendedErrorInfo]
   [-UseServerCache]
   [<CommonParameters>]

You can use the command to collect information on a specific database in your infrastructure or to get the server wide information.

Let’s explore the parameters of this command.

-Server or -Identity

This parameter will allow you to specify the server’s name from which to retrieve the information. If you want to specify a specific database in a specific server, you need to replace the -server parameter with the -Identity and specify the database/server.

-Active

This parameter will return the information concerning the copy status of the active database.

-DomainController

In this parameter, you need to specify the domain controller you will be using to read or write the data from the Active Directory. You need to specify the fully qualified domain controller (FQDN) of the server, for example, activedirectory01.mydomain.lan.

-UseServerCache

This parameter specifies whether to enable the server-side remote procedure call (RPC) caching status for 5 seconds.

How to Use Get-MailboxDatabaseCopyStatus Command?

You need to have the right permissions to run the Get-MailboxDatabaseCopyStatus cmdlet. If you do not know what permissions or role assignments are required, you can run the following command.

Get-ManagementRole -Cmdlet Get-MailboxDatabaseCopyStatus

Get ManagementRole

This command will provide the roles that you need to run the command.

If you need full permissions depending on the parameters, you need to specify the parameters (as given below) and separate each parameter with a comma.

Get-ManagementRole -Cmdlet Get-MailboxDatabaseCopyStatus -CmdLetParamaters extendederrorinfo, useServerCache

Get-MailboxDatabaseCopyStatus

After you get the right information, you need to get the permission active for the user to run the cmdlet. For this, open the Exchange Admin Center (EAC), click on Permission, and then click on Admin roles.

It is suggested that you create a new role called GetMailboxCopyStatus and set the permissions needed and assign the users.

EAC-Admin-roles

Once this is ready, you will be able to run the command.

While running the command, you may encounter many errors. The common ones are:

  • Failed
  • Crawling
  • Status Unknown
  • Failed and Suspended
  • Content Index failed

One of the things you can do to troubleshoot, before running anything, is to check:

  • Any services are down
  • There is ample space
  • There are no connectivity issues
  • There are no connectivity issues with the Active Directory

The next thing to do is run the following commands, depending on the infrastructure.

In a Database Availability Group (DAG), run the following command on the affected indexes to get the failed status.

Get-MailboxDatabase Database Name | Get-MailboxDatabaseCopyStatus | Select Name,*index*

Database Availability Group

Run the repair command to see if the issue would be fixed.

Update-MailboxDatabasecopy <database>\<server> –sourceserver <server> –catalogonly

MailboxDatabasecopy

Depending on the size of the database and server’s performance, this procedure can take some time.

In case of a standalone server, you need to follow the below procedure.

Open command prompt or PowerShell and run the following commands:

Stop-Service MSExchangeFastSearch
Stop-Service HostControllerService

Stop Service

Now, browse to the database location and look for the folder having the name with the long GUID name and delete the folder. This will delete the content index of the database. Once this is done, you need to start the services again.

Start-Service MSExchangeFastSearch
Start-Service HostControllerService

Start Service

After a few minutes, the folder will be recreated and the content index will be rebuilt.

free download

Conclusion

This is only one example as each status will need the required procedure to be performed to try to mitigate the issue. If all fails and the active database will not be able to recover from the issue, the replication between the passive and the active copy (or vice versa) will not happen. If there is a server failure or a failover, you may have to face data loss.

To quickly recover from such situations, you can rely on a certified application that will get you out of a sticky situation and recover your mailbox database with no data loss. Stellar Repair for Exchange is one such application that can open any Exchange Server database file – be it in healthy, corrupted, or dirty shutdown state. You can browse through it and export the data to PST and other file formats. The application also exports the EDB data directly to a live Exchange Server database.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.