Posted On April 8, 2019

How to Discover Active Ports on a Windows Machine

kimconnect 0 comments
blog.KimConnect.com >> Networking >> How to Discover Active Ports on a Windows Machine
PS C:\Users\kimconnect> get-nettcpsetting | select SettingName,DynamicPortRangeStartPort,DynamicPortRangeNumberOfPorts

SettingName DynamicPortRangeStartPort DynamicPortRangeNumberOfPorts
----------- ------------------------- -----------------------------
Automatic
InternetCustom 49152 16384
DatacenterCustom 49152 16384
Compat 49152 16384
Datacenter 49152 16384
Internet 49152 16384

Step 1: discover inbound ports that are actively used

netstat | findstr -i "ESTABLISHED LISTEN CLOSE_WAIT TIME_WAIT"

Step 2: find all outbound dynamic ports that are expected to be allowed through the firewalls

netsh int ipv4 show dynamicport tcp

Please note that the output of this command does not explicitly provide the named end-port. Thus, we must add the “starting port” number with the “number of ports” to derive at that value. In the example below, 49152 + 16384 = 65536

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

How to Enable GPUPDATE When Connected via OpenVPN Client

// Explanation: to prevent locking of processes, we set a proxy batch file (on_connect.bat) to…

Cisco Fabric Switch – MDS Zoning Template

<# What this script does: 1. Checks to see if an Internet connection via PowerShell…

Home OpenVPN Stuff

Config file: To Be Generated OpenVPN Client:   Note: there's an error with the Asus…