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

PFSense

This open source project is free to use and distribute, which lowers licensing costs as…

PowerShell: Alternative to Test-NetConnection for Legacy Windows

This little snippet is useful as a helper function to quickly determine port connectivity between…

How to set UniFi controller as a Windows service

Download the software: https://www.ui.com/download/unifi/ Close any instances of the UniFi software on the controller Open…
Other project: DragonCoin.com