@samitouri / QOSAMI-WSL / commits / bf268b10

fix tcpdump usage

Catalin-Emil Fetoiu committed Oct 20, 2023 at 16:24 UTC bf268b10884d54b3ecd894fd1b3f9872778b94e7
1 file changed +9 -2
diagnostics/collect-networking-logs.ps1
+9 -2
@@ -60,7 +60,7 @@ netsh wfp capture start file="$folder/wfpdiag.cab"
60 $tcpdumpProcess = $null
61 try
62 {
63 - $tcpdumpProcess = Start-Process wsl.exe -ArgumentList "-u root /bin/bash -c 'tcpdump -n -i any > $folder/tcpdump.log'" -PassThru
63 + $tcpdumpProcess = Start-Process wsl.exe -ArgumentList "-u root tcpdump -n -i any > $folder/tcpdump.log" -PassThru
64 }
65 catch {}
66
@@ -109,9 +109,10 @@ finally
109 {
110 try
111 {
112 + wsl.exe -u root killall tcpdump
113 if ($tcpdumpProcess -ne $null)
114 {
114 - Stop-Process -InputObject $tcpdumpProcess
115 + Wait-Process -InputObject $tcpdumpProcess
116 }
117 }
118 catch {}
@@ -169,6 +170,12 @@ try
170 }
171 catch {}
172
173 +try
174 +{
175 + Get-NetFirewallRule -PolicyStore ActiveStore | Out-File -FilePath "$folder/Get-NetFirewallRule_ActiveStore.log" -Append
176 +}
177 +catch {}
178 +
179 try
180 {
181 Get-NetFirewallHyperVPort | Out-File -FilePath "$folder/Get-NetFirewallHyperVPort.log" -Append