Skip to content

Instantly share code, notes, and snippets.

@jwliechty
Last active February 11, 2020 19:39
Show Gist options
  • Save jwliechty/67fa7b780e8063f766ca6b45c9551a3b to your computer and use it in GitHub Desktop.
Save jwliechty/67fa7b780e8063f766ca6b45c9551a3b to your computer and use it in GitHub Desktop.
Windows 10 Network Troubleshooting

Windows 10 Firewall Settings

To allow an application to have access in the firewall, do the following:

  1. Type "Firewall and network protection" in the Taskbar search box
  2. Click "Allow an app through firewall"
  3. Determine if the app in question is already in the list. If so, there should be two entries - one checked for "Public" and another checked for "Private". However, only the line for the "Private" network should be marked as checked unless you need the "Public" as well. A given line is considered enabled if the checkbox to the left of the entire line is marked as checked.
  4. Click "Change Settings"
  5. Click "Add another app..."
  6. Click "Browse" and navigate to the desired exe
  7. Enable for the Private network and not the Public network. If that doesn't suit your needs, enable the Public as well.
  8. Click "OK"
# Inspired by https://stackoverflow.com/questions/41267553/powershell-test-connection-failed-due-to-lack-of-resources
# See PowerShell version
Get-Host | Select-Object Version
$destinationIpOrComputerName = "MyDestinationIpOrComputerName"
$port = 7834 # destination TCP port
# Test-Connection (easy to use, often not reliable)
# checks DNS resolution
# gives IP of destination
Test-Connection $destinationIpOrComputerName -IPv4
# Test-Connection (easy to use, often not reliable)
# deterimines if can connect to destination TCP port
Test-Connection $destinationIpOrComputerName -TCPPort $port
# Use .NET TcpClient to verify port (reliable)
# if error mentions "No such host is known"
# did not resolve the IP or hostname on the network
# if error mentions "...because the target machine actively refused it...",
# resolved the IP or hostname but port is blocked or non-existent
(New-Object System.Net.Sockets.TcpClient($destinationIpOrComputerName, $port)).Connected
# Verify DNS resolving (will only look at DNS table). NSLOOKUP is more accurate
# than PING since it only looks at DNS while PING looks at DNS, NetBIOS, and WINS.
# If DNS ultimately will not resolve, it is a mis-configuration on the part of
# DNS server. Local IT will need to get involved. Much of this came from the site
# https://social.technet.microsoft.com/Forums/en-US/f82b747e-6711-418b-9b6f-317223daa2dc/access-computers-by-ip-addresses-but-not-by-computer-name?forum=w7itpronetworking
nslookup <pcname>
ping <pcname>
# Handy Commands
ipconfig /all
ipconfig /release
ipconfig /renew
ipconfig /flushdns
ipconfig /registerdns
# If nothing above works, try these lower-level calls
$ping1 = `
Get-WmiObject `
-Class Win32_PingStatus `
-Filter "Address='$destinationIpOrComputerName' AND Timeout=1000"
$ping2 = `
Get-CimInstance `
-ClassName Win32_PingStatus `
-Filter "Address='$destinationIpOrComputerName' AND Timeout=1000"
$statusCodes = @{
[uint32]0 = 'Success';
[uint32]11001 = 'Buffer Too Small';
[uint32]11002 = 'Destination Net Unreachable';
[uint32]11003 = 'Destination Host Unreachable';
[uint32]11004 = 'Destination Protocol Unreachable';
[uint32]11005 = 'Destination Port Unreachable';
[uint32]11006 = 'No Resources';
[uint32]11007 = 'Bad Option';
[uint32]11008 = 'Hardware Error';
[uint32]11009 = 'Packet Too Big';
[uint32]11010 = 'Request Timed Out';
[uint32]11011 = 'Bad Request';
[uint32]11012 = 'Bad Route';
[uint32]11013 = 'TimeToLive Expired Transit';
[uint32]11014 = 'TimeToLive Expired Reassembly';
[uint32]11015 = 'Parameter Problem';
[uint32]11016 = 'Source Quench';
[uint32]11017 = 'Option Too Big';
[uint32]11018 = 'Bad Destination';
[uint32]11032 = 'Negotiating IPSEC';
[uint32]11050 = 'General Failure'
};
$statusCodes[$ping1.StatusCode];
$statusCodes[$ping2.StatusCode];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment