Solution:
Root Cause: Host Network Service (HNS) Port Exhaustion or vSwitch Deadlock
Windows Sandbox creates a dynamic internal NAT virtual switch (
Default Switch) managed by the Host Network Service (
hns.sys). If HNS database records become corrupt or IP address pool ranges collide with active VPN/SD-WAN adapters, network adapter creation fails, preventing the guest VM from completing its startup handshake.
# Diagnostic Verification:
Query active HNS endpoints via PowerShell: powershell
Get-HnsNetwork | Select-Object Name, Type, Id
# Step-by-Step Fix:
1. Stop Host Network Service:
Run Admin PowerShell: powershell
Stop-Service -Name "hns" -Force
2. Delete Corrupted HNS Persistence Database:
Clear dynamic HNS state file: powershell
Remove-Item -Path "$env:ProgramData\Microsoft\Windows\HNS\HNS.data" -Force -ErrorAction SilentlyContinue
3. Purge Virtual Ethernet Adapters:
Remove stale virtual switches via PowerShell: powershell
Get-VMSwitch -SwitchType Internal | Where-Object Name -match "Container" | Remove-VMSwitch -Force
4. Restart HNS Service:
Re-initialize HNS to generate a clean HNS.data schema: powershell
Start-Service -Name "hns"
5. Test launching Windows Sandbox to regenerate default container network bindings.
# Prevention & Long-Term Monitoring:
Configure enterprise VPN clients to exclude virtual subnets utilized by Hyper-V dynamic NAT interfaces (172.16.0.0/12).