Add warning to collect-wsl-logs.ps1 to be displayed when tool is missing#14447
Open
andremueiot wants to merge 3 commits intomicrosoft:masterfrom
Open
Add warning to collect-wsl-logs.ps1 to be displayed when tool is missing#14447andremueiot wants to merge 3 commits intomicrosoft:masterfrom
andremueiot wants to merge 3 commits intomicrosoft:masterfrom
Conversation
added 3 commits
March 13, 2026 16:54
On executing the log collection script, it will first confirm the required tools tcpdump and iptables are installed. For each tool missing a warning is displayed, reminding the user that the tool should be installed prior to executing the script to get a more complete log collection.
…om/andremueiot/WSL_1 into user/andremueiot/warn_tool_missing
Contributor
There was a problem hiding this comment.
Pull request overview
Adds pre-flight warnings to the Windows-side diagnostics/collect-wsl-logs.ps1 script to inform users (when running the networking log profile) that certain Linux tools should be installed in WSL for more complete log capture.
Changes:
- Introduces
Test-WslApplicationto probe for required tools inside WSL and emitWrite-Warningwhen missing. - Calls the new check for
tcpdumpandiptableswhen-LogProfile networkingis selected.
You can also share your feedback on Copilot code review. Take the survey.
| # Log warning when tool is not present in WSL | ||
| try | ||
| { | ||
| & wsl.exe -e sh -lc "command -v $Command >/dev/null 2>&1" |
Comment on lines
+21
to
+31
| & wsl.exe -e sh -lc "command -v $Command >/dev/null 2>&1" | ||
| $available = ($LASTEXITCODE -eq 0) | ||
|
|
||
| if (-not $available) | ||
| { | ||
| Write-Warning "$Name not found in WSL. For a more complete log collection install $Name." | ||
| } | ||
|
|
||
| return $available | ||
| } | ||
| catch {} |
Comment on lines
+116
to
+117
| Test-WslApplication -Name "tcpdump" -Command "tcpdump --version" | Out-Null | ||
| Test-WslApplication -Name "iptables" -Command "iptables --version" | Out-Null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
On executing the log collection script, it will first confirm the required tools
tcpdumpandiptablesare installed. For each toolmissing a warning is displayed, reminding the user that the tool should be installed prior to executing the script to get a more
complete log collection.
PR Checklist
Validation Steps Performed
Ran the command below (from log collection instructions) manually in both scenarios where tools are installed and not installed.
Visually confirmed that both warning messages show up when the respective tool is not installed.
.\collect-wsl-logs.ps1 -LogProfile networking