Allow printer sharing with Windows Sandbox
Autoriser le partage d'imprimante avec Bac à sable Windows
Explanation
This policy setting enables or disables printer sharing from the host into the Sandbox.
If you enable this policy setting, host printers will be shared into Windows Sandbox.
If you disable this policy setting, Windows Sandbox will not be able to view printers from the host.
If you do not configure this policy setting, printer redirection will be disabled.
Ce paramètre de stratégie active ou désactive le partage d’imprimantes de l’hôte dans le bac à sable (sandbox).
Si vous activez ce paramètre de stratégie, les imprimantes hôtes sont partagées en Bac à sable Windows.
Si vous désactivez ce paramètre de stratégie, Bac à sable Windows ne pourrez pas afficher les imprimantes de l’hôte.
Si vous ne configurez pas ce paramètre de stratégie, la redirection de l’imprimante est désactivée.
Registry
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Sandbox- Value name
AllowPrinterRedirection
| 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/AllowPrinterRedirection
$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 'AllowPrinterRedirection' -Value 1 -Type DWordDisable
# Disable: WindowsSandbox/AllowPrinterRedirection
$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 'AllowPrinterRedirection' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": WindowsSandbox/AllowPrinterRedirection
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Sandbox'
Remove-ItemProperty -Path $k -Name 'AllowPrinterRedirection' -ErrorAction SilentlyContinue