Skip to content

Commit

Permalink
Small grammar changes (#7495)
Browse files Browse the repository at this point in the history
* Small grammar changes

- Changed admin messages to say "administrative privileges"
- Added notes for :fail and :admin

* punctuation in note messages
  • Loading branch information
byronbytes committed Nov 1, 2021
1 parent 622227b commit 7c0f633
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
26 changes: 14 additions & 12 deletions diagnostics/networking.bat
@@ -1,38 +1,38 @@
@echo off
:: Note: This script terminates WSL. Save your work before running it.

:: Check for administrator access
:: Check for administrator privileges.
net session >nul 2>&1 || goto :admin

:: Validate that required files are here
:: Validate that required files are here.
if not exist wsl_networking.wprp (echo wsl_networking.wprp not found && exit /b 1)
if not exist networking.sh (echo networking.sh not found && exit /b 1)

:: List installed Windows features
:: List installed Windows features.
echo Windows features:
powershell.exe -NoProfile "Get-WindowsOptionalFeature -Online | ? State -eq Enabled | select FeatureName"

:: List all HNS objects
:: List all HNS objects.
echo HNS objects:
hnsdiag list all -df

:: Print the Windows routing table
:: Print the Windows routing table.
echo Routing table:
netstat.exe -rn

:: The WSL HNS network is created once per boot. Resetting it to collect network creation logs
:: The WSL HNS network is created once per boot. Resetting it to collect network creation logs.
echo Deleting HNS network
powershell.exe -NoProfile "Get-HnsNetwork | Where-Object {$_.Name -eq 'WSL'} | Remove-HnsNetwork"

:: Stop WSL
:: Stop WSL.
net.exe stop LxssManager

:: Start packet capture
:: Start packet capture.
powershell.exe -NoProfile "New-NetEventSession HnsPacketCapture -CaptureMode SaveToFile -LocalFilePath %cd%\\packets.etl" || goto :fail
powershell.exe -NoProfile "Add-NetEventPacketCaptureProvider -Level 5 -SessionName HnsPacketCapture -CaptureType BothPhysicalAndSwitch " || goto :fail
powershell.exe -NoProfile "Start-NetEventSession HnsPacketCapture" || goto :fail

:: Collect WSL logs
:: Collect WSL logs.
wpr -start wsl_networking.wprp -filemode || goto :fail
wsl.exe tr -d "\r" ^| bash < ./networking.sh

Expand All @@ -41,11 +41,13 @@ powershell -NoProfile "Stop-NetEventSession HnsPacketCapture; Remove-NetEventSe

exit /b 0

:: Error message if the WSL logs fail to collect.
:fail
echo Failed to collect WSL logs
echo Failed to collect WSL logs.
powershell -NoProfile "Stop-NetEventSession HnsPacketCapture; Remove-NetEventSession HnsPacketCapture"
exit /b 1

:: Error message if the user does not have administrative privileges.
:admin
echo This script needs to run with administrative access
exit /b 1
echo This script needs to run with administrative privileges.
exit /b 1
14 changes: 7 additions & 7 deletions diagnostics/networking.sh
Expand Up @@ -7,30 +7,30 @@ fi

set -xu

# Gather distro & kernel info
# Gather distro & kernel info.
lsb_release -a || cat /etc/issue /etc/os-release
uname -a

# Output adapter & routing configuration
# Output adapter & routing configuration.
ip a
ip route show

# Validate that the gateway is responsive and can route ICMP correctly
# Validate that the gateway is responsive and can route ICMP correctly.
if gateway=$(ip route show | awk '/default/ { print $3 }'); then
ping -c 4 "$gateway"
else
echo 'No gateway found'
echo 'No gateway found.'
fi

ping -c 4 1.1.1.1

# Validate that the default route is working (won't work if traceroute isn't installed)
# Validate that the default route is working (won't work if traceroute isn't installed).
traceroute 1.1.1.1

# Display the DNS configuration
# Display the DNS configuration.
cat /etc/resolv.conf

# Validate that everything is functionning correctly
# Validate that everything is functionning correctly.
if type curl >/dev/null 2>&1; then
curl -m 5 -v https://microsoft.com
else
Expand Down

1 comment on commit 7c0f633

@StefanXhunga
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your support!

Please sign in to comment.