Skip to content

Commit

Permalink
Add a handy shortcut to collect storage logs (#11004)
Browse files Browse the repository at this point in the history
  • Loading branch information
OneBlue committed Jan 10, 2024
1 parent 4452cf2 commit 96bd92e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions diagnostics/collect-wsl-logs.ps1
Expand Up @@ -11,11 +11,25 @@ Set-StrictMode -Version Latest
$folder = "WslLogs-" + (Get-Date -Format "yyyy-MM-dd_HH-mm-ss")
mkdir -p $folder | Out-Null

if ($LogProfile -eq $null)
if ($LogProfile -eq $null -Or ![System.IO.File]::Exists($LogProfile))
{
if ($LogProfile -eq $null)
{
$url = "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl.wprp"
}
elseif ($LogProfile -eq "storage")
{
$url = "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl_storage.wprp"
}
else
{
Write-Error "Unknown log profile: $LogProfile"
exit 1
}

$LogProfile = "$folder/wsl.wprp"
try {
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl.wprp" -OutFile $LogProfile
Invoke-WebRequest -UseBasicParsing $url -OutFile $LogProfile
}
catch {
throw
Expand Down

0 comments on commit 96bd92e

Please sign in to comment.