Skip to content

Commit 96bd92e

Browse files
authored
Add a handy shortcut to collect storage logs (#11004)
1 parent 4452cf2 commit 96bd92e

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

diagnostics/collect-wsl-logs.ps1

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,25 @@ Set-StrictMode -Version Latest
1111
$folder = "WslLogs-" + (Get-Date -Format "yyyy-MM-dd_HH-mm-ss")
1212
mkdir -p $folder | Out-Null
1313

14-
if ($LogProfile -eq $null)
14+
if ($LogProfile -eq $null -Or ![System.IO.File]::Exists($LogProfile))
1515
{
16+
if ($LogProfile -eq $null)
17+
{
18+
$url = "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl.wprp"
19+
}
20+
elseif ($LogProfile -eq "storage")
21+
{
22+
$url = "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl_storage.wprp"
23+
}
24+
else
25+
{
26+
Write-Error "Unknown log profile: $LogProfile"
27+
exit 1
28+
}
29+
1630
$LogProfile = "$folder/wsl.wprp"
1731
try {
18-
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl.wprp" -OutFile $LogProfile
32+
Invoke-WebRequest -UseBasicParsing $url -OutFile $LogProfile
1933
}
2034
catch {
2135
throw

0 commit comments

Comments
 (0)