Don't bail on errors.

Peter Martincic committed May 5, 2022 at 16:18 UTC e48002006e9bc5752fada2a89861a89bdd934436
1 file changed +7 -3
diagnostics/collect-wsl-logs.ps1
+7 -3
@@ -5,7 +5,6 @@ Param (
5 $LogProfile = $null
6 )
7
8 -$ErrorActionPreference = "Stop"
8 Set-StrictMode -Version Latest
9
10 $folder = "WslLogs-" + (Get-Date -Format "yyyy-MM-dd_HH-mm-ss")
@@ -14,7 +13,12 @@ mkdir -p $folder
13 if ($LogProfile -eq $null)
14 {
15 $LogProfile = "$folder/wsl.wprp"
17 - Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl.wprp" -OutFile $LogProfile
16 + try {
17 + Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl.wprp" -OutFile $LogProfile
18 + }
19 + catch {
20 + throw
21 + }
22 }
23
24 reg.exe export HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss $folder/HKCU.reg
@@ -42,4 +46,4 @@ $logArchive = "$(Resolve-Path $folder).zip"
46 Compress-Archive -Path $folder -DestinationPath $logArchive
47 Remove-Item $folder -Recurse
48
45 -Write-Host -ForegroundColor Green "Logs saved in: $logArchive. Please attach that file to the GitHub issue."
\ No newline at end of file
49 +Write-Host -ForegroundColor Green "Logs saved in: $logArchive. Please attach that file to the GitHub issue."