Friday, April 19, 2024

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

35FollowersFollow
- Advertisement -

Latest Articles