updates
Catalin-Emil Fetoiu committed
Jan 12, 2024 at 13:38 UTC
3e905911c731859bcb3036505b0e5491b903f8cd
1 file changed
+10
diagnostics/collect-networking-logs.ps1
+10
@@ -30,7 +30,9 @@ if (Test-Path $wslconfig)
30
if ($RestartWslReproMode)
31
{
32
# The WSL HNS network is created once per boot. Resetting it to collect network creation logs.
33
+ # Note: The below commands apply only for WSL in NAT mode
34
Get-HnsNetwork | Where-Object {$_.Name -eq 'WSL'} | Remove-HnsNetwork
35
+ Get-HnsNetwork | Where-Object {$_.Name -eq 'WSL (Hyper-V firewall)'} | Remove-HnsNetwork
36
37
# Stop WSL.
38
net.exe stop WslService
@@ -222,6 +224,14 @@ try
224
}
225
catch {}
226
227
+try
228
+{
229
+ # Collect HNS events from past 24 hours
230
+ $events = Get-WinEvent -ProviderName Microsoft-Windows-Host-Network-Service | Where-Object { $_.TimeCreated -ge ((Get-Date) - (New-TimeSpan -Day 1)) }
231
+ ($events | ForEach-Object { '{0},{1},{2},{3}' -f $_.TimeCreated, $_.Id, $_.LevelDisplayName, $_.Message }) -join [environment]::NewLine | Out-File -FilePath "$folder/hns_events.log" -Append
232
+}
233
+catch {}
234
+
235
Remove-Item $logProfile
236
Remove-Item $networkingBashScript
237