Ports.txt
@echo off
REM This script will show what TCP and UDP ports are listening and show what programs are listening on
those ports.
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.
@echo Open ports and running applications for %computername% > %SystemDrive%\%computername%.txt
cd \ & netstat -ano >> %SystemDrive%\%computername%.txt
@echo.>> %SystemDrive%\%computername%.txt
@echo.>> %SystemDrive%\%computername%.txt
@echo “———————————————————————————” >> %SystemDrive%\%computername%.txt
@echo “——————programs that are listening are listed below——————-” >> %SystemDrive%\%computername%.txt
@echo “———————————————————————————” >> %SystemDrive%\%computername%.txt
tasklist /svc >> %SystemDrive%\%computername%.txt
notepad %SystemDrive%\%computername%.txt
REM find /I “Listening” %SystemDrive%\%computername%.txt >> %SystemDrive%\%computername%.Listening.txt
REM find /I “Established” %SystemDrive%\%computername%.txt >> %SystemDrive%\%computername%.Established.txt
REM find /I “Listening” %SystemDrive%\%computername%.txt >>
\\servername\sharename\%computername%.Listening.txt
REM find /I “Established” %SystemDrive%\%computername%.txt >>
\\servername\sharename\%computername%.Established.txt
REM End of Script
REM Robert Holland