Add a handy shortcut to collect storage logs (#11004)

This commit is contained in:
Blue
2024-01-10 11:47:25 -08:00
committed by GitHub
parent 4452cf2345
commit 96bd92ee98

View File

@@ -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