Prevent adding user-specified locations to the All Locations menu
Empêcher d’ajouter des emplacements spécifiés par l’utilisateur au menu Tous les fichiers
Explanation
This policy setting allows you to enable or disable the Add/Remove location options on the All Locations menu as well as any defined locations that were made by a user. When this policy is not configured, the default behavior is to allow users to add and remove new locations to the locations menu. When the policy is enabled, the Add and Remove locations options and any previously defined user locations will not be visible. When the policy is disabled, both the Add and Remove locations options as well as any previously specified user locations will be visible.
Ce paramètre de stratégie vous permet d’activer ou de désactiver les options Ajouter/Supprimer un fichier dans le menu Tous les fichiers ainsi que les fichiers définis créés par un utilisateur. Si cette stratégie n’est pas configurée, le comportement par défaut consiste à autoriser les utilisateurs à ajouter et supprimer de nouveaux fichiers dans le menu. Si la stratégie est activée, les options d’ajout et de suppression de fichiers ainsi que les fichiers définis par l’utilisateur ne sont pas visibles. Si cette stratégie est désactivée, les options d’ajout et de suppression de fichiers ainsi que les fichiers définis par l’utilisateur sont visibles.
Registry
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search- Value name
FavoriteLocations
| 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/FavoriteLocations
$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 'FavoriteLocations' -Value 1 -Type DWordDisable
# Disable: Search/FavoriteLocations
$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 'FavoriteLocations' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": Search/FavoriteLocations
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
Remove-ItemProperty -Path $k -Name 'FavoriteLocations' -ErrorAction SilentlyContinue