Question:
How can we generate a text file that lists all ports alongside the processes utilizing them?
Answer:
To generate a text file containing the ports currently in use, the associated process IDs, executable names, and Windows services, follow these steps:
- Open Command Prompt and Run as administrator.
- Run the following commands;
netstat -abno > C:\ports.txt
tasklist /svc >> C:\ports.txt
The first command will generate a text file on the C: drive, or you can change this to any location you'd like by adjusting the command. This text file includes active connections, listening ports, process IDs, and executable names.
The second command appends a list of running processes and their associated Windows services to the same file. This makes it easier to match a process ID from the netstat output to the corresponding service.
NOTE: Netstat shows the ports that are listening or in use at the time the command is run. It does not confirm whether a firewall permits traffic through those ports.
This is helpful in cases when predefined DocuWare ports are used by a different application, conflicting with the connection. Please see the scenario in the above example, which can be found here.
KBA is applicable for both Cloud and On-premise Organizations.
