Created
June 20, 2014 05:57
-
-
Save rldutch1/781367257aacbd6e6e5c to your computer and use it in GitHub Desktop.
Show Open Ports in Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Author: Robert Holland | |
REM Creation Date: 10 June 2001 | |
REM Purpose: This script will show what TCP and UDP ports are listening and show what programs are listening on those ports. | |
REM It will also show the TCP and UDP connections that are established on the computer and what programs are connected. | |
REM Just match the PID (Process ID’s) to find out what programs are using the ports. | |
REM The ports will be listed above the dashed line and the programs will be listed below. | |
REM Robert Holland | |
@echo Open ports and running applications for %computername% > %computername%.Ports.txt | |
netstat -ano >> %computername%.Ports.txt | |
@echo.>> %computername%.Ports.txt | |
@echo.>> %computername%.Ports.txt | |
@echo "———————————————————————————" >> %computername%.Ports.txt | |
@echo "——————programs that are listening are listed below. Just match the PID from above.——————-" >> %computername%.Ports.txt | |
@echo "———————————————————————————" >> %computername%.Ports.txt | |
tasklist /svc >> %computername%.Ports.txt | |
call notepad %computername%.Ports.txt | |
REM find /I "Listening" %computername%.Ports.txt >> %computername%.Listening.txt | |
REM find /I "Established" %computername%.Ports.txt >> %computername%.Established.txt | |
REM find /I "Listening" %computername%.Ports.txt >> \\servername\sharename\%computername%.Listening.txt | |
REM find /I "Established" %computername%.Ports.txt >> \\servername\sharename\%computername%.Established.txt | |
REM End of Script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment