How to install Exchange certificate with PowerShell? You already have a certificate and you want…
Repair failed content index in Exchange
A database shows as failed content index in Exchange Server, and you like to fix that. It can be one or more databases. Good to know is that when you repair a failed content index in Exchange Server, it can cause high CPU utilization on the Exchange Server. It’s essential to enable search indexing after working hours or at an off-peak time as it can impact performance. In this article, you will learn how to rebuild Exchange search index.
Table of contents
How to rebuild Exchange search index
Follow the steps below to rebuild the Exchange Search index and fix the search indexing issues.
Note: The below method works for pre-Exchange Server 2019. This behavior changed since Exchange Server 2019 and will show the ContentIndexState as NotApplicable when you run the commands in Exchange Management Shell.
1. Get Exchange content index status
Let’s get the status of the content indexing. Run Exchange Management Shell as administrator. Run the following command.
[PS] C:\>Get-MailboxDatabaseCopyStatus * | Sort Name | Select Name, Status, ContentIndexState
Name Status ContentIndexState
---- ------ -----------------
DB10-2016\EX01 Mounted Healthy
DB10-2016\EX02 Healthy Healthy
DB11-2016\EX01 Mounted Healthy
DB11-2016\EX02 Healthy Healthy
DB12-2016\EX01 Mounted Healthy
DB12-2016\EX02 Healthy Healthy
DB13-2016\EX01 Mounted Failed
DB13-2016\EX02 Healthy Failed
[PS] C:\>Get-MailboxDatabaseCopyStatus * | Sort Name | Select Name, Status, ContentIndexState
Name Status ContentIndexState
---- ------ -----------------
DB10-2016\EX01 Mounted Healthy
DB10-2016\EX02 Healthy Healthy
DB11-2016\EX01 Mounted Healthy
DB11-2016\EX02 Healthy Healthy
DB12-2016\EX01 Mounted Healthy
DB12-2016\EX02 Healthy Healthy
DB13-2016\EX01 Mounted Failed
DB13-2016\EX02 Healthy FailedAndSuspended
You will see one of the following outputs. The database DB13-2016 ContentIndexState shows Failed or FailedAndSuspended.
Let’s rebuild the index.
2. Stop services
Stop the services first by running the two commands.
[PS] C:\>Stop-Service MSExchangeFastSearch
WARNING: Waiting for service 'Microsoft Exchange Search (MSExchangeFastSearch)' to stop...
[PS] C:\>Stop-Service HostControllerService
WARNING: Waiting for service 'Microsoft Exchange Search Host Controller (HostcontrollerService)' to stop...
WARNING: Waiting for service 'Microsoft Exchange Search Host Controller (HostcontrollerService)' to stop...
We can stop both services with a one-liner.
[PS] C:\>Get-Service -Name "HostControllerService","MSExchangeFastSearch" | Stop-Service
WARNING: Waiting for service 'Microsoft Exchange Search Host Controller (HostControllerService)' to stop...
WARNING: Waiting for service 'Microsoft Exchange Search Host Controller (HostControllerService)' to stop...
WARNING: Waiting for service 'Microsoft Exchange Search (MSExchangeFastSearch)' to stop...
WARNING: Waiting for service 'Microsoft Exchange Search (MSExchangeFastSearch)' to stop...
Both services stopped. Proceed with the next steps.
3. Identify mailbox database
If you know the database location, go to that folder in Windows Explorer. If you don’t know, you can run the following command. It will show the database folder path.
[PS] C:\>Get-MailboxDatabase "DB13-2016" | Select EdbFilePath
EdbFilePath
-----------
F:\DB13-2016\DB13-2016.edb
4. Remove Exchange indexing folder
Go to the folder F:\DB13-2016 in Windows Explorer. Delete the Global Unique Identifier (GUID) folder.
The next step is to start the services.
5. Start services
Start both services with the first two commands or use the third command as a one-liner.
[PS] C:\>Start-Service MSExchangeFastSearch
[PS] C:\>Start-Service HostControllerService
[PS] C:\>Get-Service -Name "HostControllerService","MSExchangeFastSearch" | Start-Service
Both the services started. It will create a new GUID folder in the directory F:\DB13-2016.
6. Check Exchange index status
Give it a few minutes before checking the content search indexing status.
[PS] C:\>Get-MailboxDatabaseCopyStatus * | Sort Name | Select Name, Status, ContentIndexState
Name Status ContentIndexState
---- ------ -----------------
DB10-2016\EX01 Mounted Healthy
DB10-2016\EX02 Healthy Healthy
DB11-2016\EX01 Mounted Healthy
DB11-2016\EX02 Healthy Healthy
DB12-2016\EX01 Mounted Healthy
DB12-2016\EX02 Healthy Healthy
DB13-2016\EX01 Mounted Crawling
DB13-2016\EX02 Healthy FailedAndSuspended
The mailbox database DB13-2016 shows the content index state Crawling. It can take some time before it finishes crawling.
Note: Do you like to have an estimate of the remaining mailboxes that it needs to crawl? Read more on how to monitor Exchange database index state crawling.
7. Final results
After it finishes crawling, the database copy will change to a Healthy status. The FailedAndSuspended content index state will also change to Healthy.
[PS] C:\>Get-MailboxDatabaseCopyStatus * | Sort Name | Select Name, Status, ContentIndexState
Name Status ContentIndexState
---- ------ -----------------
DB10-2016\EX01 Mounted Healthy
DB10-2016\EX02 Healthy Healthy
DB11-2016\EX01 Mounted Healthy
DB11-2016\EX02 Healthy Healthy
DB12-2016\EX01 Mounted Healthy
DB12-2016\EX02 Healthy Healthy
DB13-2016\EX01 Mounted Healthy
DB13-2016\EX02 Healthy Healthy
That’s it!
Read more: Add database copy Exchange Server »
Conclusion
You learned how to repair failed content index in Exchange Server. It’s important to repair the search indexing after working hours or at an off-peak time, as it can impact performance.
Did you enjoy this article? You may also like Activate database copy failed content index disabled. Don’t forget to follow us and share this article.
Hi
I have this Problem
Name Status CopyQueueLength ReplayQueueLength LastInspectedLogTime ContentIndexState
—- —— ————— —————– ——————– —————–
MailDB01\EXG4 Mounted 0 0 NotApplicable
MailDB02\EXG4 Mounted 0 0 NotApplicable
how to make them healthy
thanks
This behavior changed on Exchange Server 2019. The ContentIndexState shows as NotApplicable when you run the commands in Exchange Management Shell.
Read more: Exchange Server Content index state: NotApplicable.
Do you have a version that works with Exchange 2019?
The GUID file doesn’t exist in 2019.
It’s changed since Exchange Server 2019, and there is no GUID file. As a result, the ContentIndexState shows as NotApplicable when you run the commands in Exchange Management Shell.
Read more: Exchange Server Content index state: NotApplicable.
Tnx Dear Ali