Wednesday, August 17, 2022

Disable content indexing on all DBs on an Exchange DAG

Abstract: On some Exchange environments you might to disable the content indexing, but didn´t wish to perform that on every DB by hand, so you need a script

The following script:

# Tested on Exchange 2016

CLS
Write-Host "This script disabled the MS Search Index on all DBs on a given Exchange DAG"
Write-Host "...Working ... Please wait... collecting mail DBs..."

$ExMailBoxes = Get-MailboxDatabase | where {$_.MasterServerOrAvailabilityGroup -eq "EXCHDAG01"}

foreach ($MailBox in $ExMailBoxes)
{

        Write-Host "-------------------------------------------------------"  -foregroundcolor green

       
        if ($Mailbox.IndexEnabled -eq "true")
        {
       
            Write-Host "Will disable index for:"$Mailbox.Name
           
            # https://technet.microsoft.com/en-us/library/aa996416(v=exchg.150).aspx
            Set-MailboxDatabase -Identity $Mailbox.Name -IndexEnabled $false
        }
        else
        {
            Write-Host "Index already disabled for:"$Mailbox.Name
        }

        Write-Host "-------------------------------------------------------"  -foregroundcolor green
       
}

Will disable the content indexing on all Exchange mail DBs on an Exchange DAG with the name EXCHDAG01 if it is still enabled. According to the technet article here, disabling Exchange Search impacts the functionality and performance of the full-text searches that are performed by your users using Outlook in online mode or on Windows mobile devices. But if you use Outlook Cache mode, the local indexing is used, rather then the on the server (so you might not need it here). In-Place eDiscovery also relies on Exchange Search. If you disable Exchange Search for a mailbox database or for a Mailbox server, In-Place eDiscovery searches won`t return any messages from the database or server.

 

Note:

This could be used if you see that the noderunner.exe takes a very high amount of CPU. Then you can disable the content indexing and enable it only on the DBs where you need it.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

23FollowersFollow
- Advertisement -

Latest Articles