Allow networking in Windows Sandbox
Autoriser la mise en réseau dans Bac à sable Windows
Explanation
This policy setting enables or disables networking in the sandbox. You can disable network access to decrease the attack surface exposed by the sandbox.
If you enable this policy setting, networking is done by creating a virtual switch on the host, and connects the Windows Sandbox to it via a virtual NIC.
If you disable this policy setting, networking is disabled in Windows Sandbox.
If you do not configure this policy setting, networking will be enabled.
Note that enabling networking can expose untrusted applications to the internal network.
Ce paramètre de stratégie active ou désactive la mise en réseau dans le bac à sable (sandbox). Vous pouvez désactiver l’accès réseau pour réduire la surface d’attaque exposée par le bac à sable (sandbox).
Si vous activez ce paramètre de stratégie, la mise en réseau est effectuée en créant un commutateur virtuel sur l’ordinateur hôte et connecte le Bac à sable Windows à celui-ci via une carte réseau virtuelle.
Si vous désactivez ce paramètre de stratégie, la mise en réseau est désactivée dans Bac à sable Windows.
Si vous ne configurez pas ce paramètre de stratégie, la mise en réseau est activée.
Notez que l’activation de la mise en réseau peut exposer des applications non approuvées au réseau interne.
Registry
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Sandbox- Value name
AllowNetworking
| 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/AllowNetworking
$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 'AllowNetworking' -Value 1 -Type DWordDisable
# Disable: WindowsSandbox/AllowNetworking
$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 'AllowNetworking' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": WindowsSandbox/AllowNetworking
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Sandbox'
Remove-ItemProperty -Path $k -Name 'AllowNetworking' -ErrorAction SilentlyContinue