Allow mapping folders into Windows Sandbox
Autoriser le mappage des dossiers dans Bac à sable Windows
Explanation
This policy setting enables or disables mapping folders into sandbox.
If you enable this policy setting, mapping folders from the host into Sandbox will be permitted.
If you enable this policy setting and disable write to mapped folders, mapping folders from the host into Sandbox will be permitted, but Sandbox will only have permission to read the files.
If you disable this policy setting, mapping folders from the host into Sandbox will not be permitted.
If you do not configure this policy setting, mapped folders will be enabled.
Note that there may be security implications of exposing folders from the host into the container.
Ce paramètre de stratégie active ou désactive le mappage des dossiers dans le bac à sable.
Si vous activez ce paramètre de stratégie, le mappage des dossiers de l’hôte dans le bac à sable est autorisé.
Si vous activez ce paramètre de stratégie et désactivez l’écriture dans les dossiers mappés, le mappage des dossiers de l’hôte dans le bac à sable sera autorisé, mais sandbox aura uniquement l’autorisation de lire les fichiers.
Si vous désactivez ce paramètre de stratégie, le mappage des dossiers de l’hôte dans le bac à sable ne sera pas autorisé.
Si vous ne configurez pas ce paramètre de stratégie, les dossiers mappés sont activés.
Notez que l’exposition de dossiers de l’hôte dans le conteneur peut avoir des implications en matière de sécurité.
Registry
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Sandbox- Value name
AllowMappedFolders
| 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: WindowsSandbox/AllowMappedFolders
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Sandbox'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'AllowMappedFolders' -Value 1 -Type DWord
# Allow Sandbox to write to mapped folders.
# unchecked: 0
Set-ItemProperty -Path $k -Name 'AllowWriteToMappedFolders' -Value 1 -Type DWordDisable
# Disable: WindowsSandbox/AllowMappedFolders
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Sandbox'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'AllowMappedFolders' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": WindowsSandbox/AllowMappedFolders
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Sandbox'
Remove-ItemProperty -Path $k -Name 'AllowMappedFolders' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'AllowWriteToMappedFolders' -ErrorAction SilentlyContinueOptions (1)
| Label | Control | Registry value | REG type | Constraints / details |
|---|---|---|---|---|
| Allow Sandbox to write to mapped folders.Autorisez le bac à sable à écrire dans les dossiers mappés.CheckBox_AllowWriteToMappedFolders | Check boxboolean | AllowWriteToMappedFolders | REG_DWORD | Default (UI): true Checked: REG_DWORD = 1Unchecked: REG_DWORD = 0 |