Select Page

The other day I need to see the names of the processes using network ports  so I created the following script to do just that!

 

## PowerShell script to list all the processes using network connections
## Version 1.0 12/28/2020
## Tom Fenton
##
#

$netstat = netstat -aon | Select-String -pattern “(TCP|UDP)”
$processList = Get-Process

foreach ($result in $netstat) {
$splitArray = $result -split ” “
$procID = $splitArray[$splitArray.length – 1]
$processName = $processList | Where-Object {$_.id -eq $procID} | select processname
$splitArray[$splitArray.length – 1] = $procID + ” ” + $processName.processname
$splitArray -join ” “
}

 

 

Social Share Buttons and Icons powered by Ultimatelysocial