Prevent automatically adding shared folders to the Windows Search index
Empêcher l’ajout automatique de dossiers partagés à l’index Windows Search
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.
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
| State | Value written |
|---|---|
| Enabled | REG_DWORD = 1 |
| Disabled | REG_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 DWordDisable
# 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 DWordRevert 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