Open in the explorer

Prevent automatically adding shared folders to the Windows Search index

Empêcher l’ajout automatique de dossiers partagés à l’index Windows Search

Type
Computer
GPO path
Computer Configuration › Policies › Administrative Templates › Windows Components › Search FR: Configuration ordinateur › Stratégies › Modèles d'administration › Composants Windows › Rechercher
Supported on
Any version of Microsoft Windows with Windows Search 4.0 FR: Toute version de Microsoft Windows avec Windows Search 4.0
ADMX file
Search.admx
Internal name
Search/AutoIndexSharedFolders

Explanation

This policy setting configures how Windows Search adds shared folders to the search index.

If you enable this policy setting, Windows Search is prevented from automatically adding shared folders to the index. Windows Search does not automatically add shares created on the computer to the scope of the index.

If you disable or do not configure this policy setting, Windows Search monitors which folders are shared or not shared on this computer, and automatically adds them to or removes them from the index.

French text from Windows 11 26H2

Ce paramètre de stratégie configure la façon dont Windows Search ajoute des dossiers partagés à l’index de recherche.

Si vous activez ce paramètre de stratégie, Windows Search ne peut pas ajouter automatiquement des dossiers partagés à l’index. Windows Search n’ajoute pas automatiquement les partages créés sur l’ordinateur à l’étendue de l’index.

Si vous désactivez ou ne configurez pas ce paramètre de stratégie, Windows Search surveille les dossiers partagés ou non partagés sur cet ordinateur et les ajoute automatiquement à l’index ou les supprime de ce dernier.

Registry

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search
Value name
AutoIndexSharedFolders
StateValue written
EnabledREG_DWORD = 1
DisabledREG_DWORD = 0

PowerShell

PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.

Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.

Enable

# Enable: Search/AutoIndexSharedFolders
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'AutoIndexSharedFolders' -Value 1 -Type DWord

Disable

# Disable: Search/AutoIndexSharedFolders
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'AutoIndexSharedFolders' -Value 0 -Type DWord

Revert to "Not configured"

# Revert to "Not configured": Search/AutoIndexSharedFolders
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
Remove-ItemProperty -Path $k -Name 'AutoIndexSharedFolders' -ErrorAction SilentlyContinue

Availability