Small grammar changes (#7495)
* Small grammar changes - Changed admin messages to say "administrative privileges" - Added notes for :fail and :admin * punctuation in note messages
Byron committed
Nov 1, 2021 at 18:57 UTC
7c0f6331bdd426f221b47012f50dccbd2636962c
2 files changed
+21
-19
diagnostics/networking.bat
+14
-12
@@ -1,38 +1,38 @@
1
@echo off
2
:: Note: This script terminates WSL. Save your work before running it.
3
4
-:: Check for administrator access
4
+:: Check for administrator privileges.
5
net session >nul 2>&1 || goto :admin
6
7
-:: Validate that required files are here
7
+:: Validate that required files are here.
8
if not exist wsl_networking.wprp (echo wsl_networking.wprp not found && exit /b 1)
9
if not exist networking.sh (echo networking.sh not found && exit /b 1)
10
11
-:: List installed Windows features
11
+:: List installed Windows features.
12
echo Windows features:
13
powershell.exe -NoProfile "Get-WindowsOptionalFeature -Online | ? State -eq Enabled | select FeatureName"
14
15
-:: List all HNS objects
15
+:: List all HNS objects.
16
echo HNS objects:
17
hnsdiag list all -df
18
19
-:: Print the Windows routing table
19
+:: Print the Windows routing table.
20
echo Routing table:
21
netstat.exe -rn
22
23
-:: The WSL HNS network is created once per boot. Resetting it to collect network creation logs
23
+:: The WSL HNS network is created once per boot. Resetting it to collect network creation logs.
24
echo Deleting HNS network
25
powershell.exe -NoProfile "Get-HnsNetwork | Where-Object {$_.Name -eq 'WSL'} | Remove-HnsNetwork"
26
27
-:: Stop WSL
27
+:: Stop WSL.
28
net.exe stop LxssManager
29
30
-:: Start packet capture
30
+:: Start packet capture.
31
powershell.exe -NoProfile "New-NetEventSession HnsPacketCapture -CaptureMode SaveToFile -LocalFilePath %cd%\\packets.etl" || goto :fail
32
powershell.exe -NoProfile "Add-NetEventPacketCaptureProvider -Level 5 -SessionName HnsPacketCapture -CaptureType BothPhysicalAndSwitch " || goto :fail
33
powershell.exe -NoProfile "Start-NetEventSession HnsPacketCapture" || goto :fail
34
35
-:: Collect WSL logs
35
+:: Collect WSL logs.
36
wpr -start wsl_networking.wprp -filemode || goto :fail
37
wsl.exe tr -d "\r" ^| bash < ./networking.sh
38
@@ -41,11 +41,13 @@ powershell -NoProfile "Stop-NetEventSession HnsPacketCapture; Remove-NetEventSe
41
42
exit /b 0
43
44
+:: Error message if the WSL logs fail to collect.
45
:fail
45
-echo Failed to collect WSL logs
46
+echo Failed to collect WSL logs.
47
powershell -NoProfile "Stop-NetEventSession HnsPacketCapture; Remove-NetEventSession HnsPacketCapture"
48
exit /b 1
49
50
+:: Error message if the user does not have administrative privileges.
51
:admin
50
-echo This script needs to run with administrative access
51
-exit /b 1
\ No newline at end of file
52
+echo This script needs to run with administrative privileges.
53
+exit /b 1
diagnostics/networking.sh
+7
-7
@@ -7,30 +7,30 @@ fi
7
8
set -xu
9
10
-# Gather distro & kernel info
10
+# Gather distro & kernel info.
11
lsb_release -a || cat /etc/issue /etc/os-release
12
uname -a
13
14
-# Output adapter & routing configuration
14
+# Output adapter & routing configuration.
15
ip a
16
ip route show
17
18
-# Validate that the gateway is responsive and can route ICMP correctly
18
+# Validate that the gateway is responsive and can route ICMP correctly.
19
if gateway=$(ip route show | awk '/default/ { print $3 }'); then
20
ping -c 4 "$gateway"
21
else
22
- echo 'No gateway found'
22
+ echo 'No gateway found.'
23
fi
24
25
ping -c 4 1.1.1.1
26
27
-# Validate that the default route is working (won't work if traceroute isn't installed)
27
+# Validate that the default route is working (won't work if traceroute isn't installed).
28
traceroute 1.1.1.1
29
30
-# Display the DNS configuration
30
+# Display the DNS configuration.
31
cat /etc/resolv.conf
32
33
-# Validate that everything is functionning correctly
33
+# Validate that everything is functionning correctly.
34
if type curl >/dev/null 2>&1; then
35
curl -m 5 -v https://microsoft.com
36
else