mirror of
https://github.com/microsoft/WSL.git
synced 2025-12-10 00:44:55 -06:00
make script run as standalone
This commit is contained in:
parent
ece79e8d59
commit
da25b43756
@ -132,12 +132,9 @@ Install [WPR](https://learn.microsoft.com/en-us/windows-hardware/test/wpt/window
|
||||
To collect WSL networking logs, do the following steps in an administrative powershell prompt:
|
||||
|
||||
```
|
||||
$ Invoke-WebRequest 'https://github.com/microsoft/WSL/archive/refs/heads/master.zip' -OutFile .\wsl.zip
|
||||
$ Expand-Archive .\wsl.zip .\
|
||||
$ Remove-Item .\wsl.zip
|
||||
$ cd .\WSL-master\diagnostics
|
||||
$ Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
$ .\collect-networking-logs.ps1
|
||||
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-networking-logs.ps1" -OutFile collect-networking-logs.ps1
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
.\collect-networking-logs.ps1
|
||||
```
|
||||
The script will output when log collection starts. Reproduce the problem, then press any key to stop the log collection.
|
||||
The script will output the path of the log file once done.
|
||||
|
||||
@ -8,6 +8,13 @@ Param (
|
||||
$folder = "WslNetworkingLogs-" + (Get-Date -Format "yyyy-MM-dd_HH-mm-ss")
|
||||
mkdir -p $folder
|
||||
|
||||
$logProfile = "$folder/wsl_networking.wprp"
|
||||
$networkingBashScript = "$folder/networking.sh"
|
||||
|
||||
# Download supporting files
|
||||
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/wsl_networking.wprp" -OutFile $logProfile
|
||||
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/networking.sh" -OutFile $networkingBashScript
|
||||
|
||||
# Retrieve WSL version and wslconfig file
|
||||
get-appxpackage MicrosoftCorporationII.WindowsSubsystemforLinux > $folder/appxpackage.txt
|
||||
|
||||
@ -18,7 +25,7 @@ if (Test-Path $wslconfig)
|
||||
}
|
||||
|
||||
# Collect Linux network state before the repro
|
||||
& wsl.exe -e ./networking.sh 2>&1 > $folder/linux_network_configuration_before.log
|
||||
& wsl.exe -e $networkingBashScript 2>&1 > $folder/linux_network_configuration_before.log
|
||||
|
||||
if ($RestartWslReproMode)
|
||||
{
|
||||
@ -34,7 +41,6 @@ if ($RestartWslReproMode)
|
||||
}
|
||||
|
||||
# Start logging.
|
||||
$logProfile = ".\wsl_networking.wprp"
|
||||
$wprOutputLog = "$folder/wpr.txt"
|
||||
|
||||
wpr.exe -start $logProfile -filemode 2>&1 >> $wprOutputLog
|
||||
@ -123,7 +129,7 @@ finally
|
||||
}
|
||||
|
||||
# Collect Linux network state after the repro
|
||||
& wsl.exe -e ./networking.sh 2>&1 > $folder/linux_network_configuration_after.log
|
||||
& wsl.exe -e $networkingBashScript 2>&1 > $folder/linux_network_configuration_after.log
|
||||
|
||||
# Collect host networking state relevant for WSL
|
||||
# Using a try/catch for commands below, as some of them do not exist on all OS versions
|
||||
@ -216,6 +222,9 @@ try
|
||||
}
|
||||
catch {}
|
||||
|
||||
Remove-Item $logProfile
|
||||
Remove-Item $networkingBashScript
|
||||
|
||||
$logArchive = "$(Resolve-Path $folder).zip"
|
||||
Compress-Archive -Path $folder -DestinationPath $logArchive
|
||||
Remove-Item $folder -Recurse
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user