Improve collect-wsl-logs.ps1's output (#10916)

Blue committed Dec 14, 2023 at 11:54 UTC dcd0348a4b58c041298583189a6114a4dbd2b2fb
1 file changed +10 -8
diagnostics/collect-wsl-logs.ps1
+10 -8
@@ -9,7 +9,7 @@ Param (
9 Set-StrictMode -Version Latest
10
11 $folder = "WslLogs-" + (Get-Date -Format "yyyy-MM-dd_HH-mm-ss")
12 -mkdir -p $folder
12 +mkdir -p $folder | Out-Null
13
14 if ($LogProfile -eq $null)
15 {
@@ -22,18 +22,18 @@ if ($LogProfile -eq $null)
22 }
23 }
24
25 -reg.exe export HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss $folder/HKCU.txt
26 -reg.exe export HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Lxss $folder/HKLM.txt
27 -reg.exe export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\P9NP $folder/P9NP.txt
28 -reg.exe export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2 $folder/Winsock2.txt
25 +reg.exe export HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss $folder/HKCU.txt | Out-Null
26 +reg.exe export HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Lxss $folder/HKLM.txt | Out-Null
27 +reg.exe export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\P9NP $folder/P9NP.txt | Out-Null
28 +reg.exe export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2 $folder/Winsock2.txt | Out-Null
29
30 $wslconfig = "$env:USERPROFILE/.wslconfig"
31 if (Test-Path $wslconfig)
32 {
33 - Copy-Item $wslconfig $folder
33 + Copy-Item $wslconfig $folder | Out-Null
34 }
35
36 -get-appxpackage MicrosoftCorporationII.WindowsSubsystemforLinux > $folder/appxpackage.txt
36 +get-appxpackage MicrosoftCorporationII.WindowsSubsystemforLinux -ErrorAction Ignore > $folder/appxpackage.txt
37 get-acl "C:\ProgramData\Microsoft\Windows\WindowsApps" -ErrorAction Ignore | Format-List > $folder/acl.txt
38 Get-WindowsOptionalFeature -Online > $folder/optional-components.txt
39 bcdedit.exe > $folder/bcdedit.txt
@@ -55,7 +55,9 @@ if ($LastExitCode -Ne 0)
55
56 try
57 {
58 - Write-Host -NoNewLine -ForegroundColor Green "Log collection is running. Please reproduce the problem and press any key to save the logs."
58 + Write-Host -NoNewLine "Log collection is running. Please "
59 + Write-Host -NoNewLine -ForegroundColor Red "reproduce the problem "
60 + Write-Host -NoNewLine "and once done press any key to save the logs."
61
62 $KeysToIgnore =
63 16, # Shift (left or right)