Disable Known Folders
Désactiver les dossiers connus
Explanation
This policy setting allows you to specify a list of known folders that should be disabled. Disabling a known folder will prevent the underlying file or directory from being created via the known folder API. If the folder exists before the policy is applied, the folder must be manually deleted since the policy only blocks the creation of the folder.
You can specify a known folder using its known folder id or using its canonical name. For example, the Sample Videos known folder can be disabled by specifying {440fcffd-a92b-4739-ae1a-d4a54907c53f} or SampleVideos.
Note: Disabling a known folder can introduce application compatibility issues in applications that depend on the existence of the known folder.
Ce paramètre de stratégie vous permet de spécifier une liste de dossiers connus à désactiver. La désactivation d’un dossier connu empêche que le fichier ou le répertoire sous-jacent soit créé par le biais de l’API du dossier connu. Si le dossier existe déjà lorsque la stratégie est appliquée, il doit être supprimé manuellement, car la stratégie empêche uniquement la création du dossier.
Vous pouvez spécifier un dossier connu à l’aide de son ID ou de son nom canonique. Par exemple, le dossier connu Vidéos exemples peut être désactivé en spécifiant {440fcffd-a92b-4739-ae1a-d4a54907c53f} ou SampleVideos.
Remarque : la désactivation d’un dossier connu peut entraîner des problèmes de compatibilité dans les applications qui ont besoin du dossier connu pour fonctionner correctement.
Registry
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer- Value name
DisableKnownFolders
| 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: WindowsExplorer/DisableKnownFolders
$k = 'HKCU:\Software\Policies\Microsoft\Windows\Explorer'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'DisableKnownFolders' -Value 1 -Type DWord
$k = 'HKCU:\Software\Policies\Microsoft\Windows\Explorer\DisableKnownFolders'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# Disable these Known Folders.
$values = @('<value1>', '<value2>') # Replace the values with your own
foreach ($v in $values) { Set-ItemProperty -Path $k -Name $v -Value $v -Type String }Disable
# Disable: WindowsExplorer/DisableKnownFolders
$k = 'HKCU:\Software\Policies\Microsoft\Windows\Explorer'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'DisableKnownFolders' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": WindowsExplorer/DisableKnownFolders
$k = 'HKCU:\Software\Policies\Microsoft\Windows\Explorer'
Remove-ItemProperty -Path $k -Name 'DisableKnownFolders' -ErrorAction SilentlyContinue
$k = 'HKCU:\Software\Policies\Microsoft\Windows\Explorer\DisableKnownFolders'
Remove-Item -Path $k -Recurse -Force -ErrorAction SilentlyContinueOptions (1)
| Label | Control | Registry value | REG type | Constraints / details |
|---|---|---|---|---|
| Disable these Known Folders.Désactiver ces dossiers connusDisableKnownFolders_Prompt | List (table)list | Software\Policies\Microsoft\Windows\Explorer\DisableKnownFoldersNumbered values (1, 2, 3…) · additive | REG_SZ (values under the key) |