Netstat Process Name

Netstat process name

Sometime we face computer internet slowness issue or upload/download slowness and wants to figure out the applications which all are running in background and consuming network bandwidth here is script netstat process name created in powershell.

Netstat is a command which provide statistics of the protocol TCP/UDP with local IP address and foreign IP address including port numbers but it doesn’t provide the process name which actually running in task manager and connected to internet. However this can be identified through PID which can be extracted from netstat command and individually identify the PID from task manager but this is very lengthy procedure because you don’t even know how much connections are established the another way is to run with elevated command prompt which is sometime not possible in client environment/remote support.

Here I have created one powershell script to get Network Statistics through Netstat process name to display in one windows rather than finding each process id in task manager.

Two ways to  run below script.
1. copy below script and paste directly on powershell command prompt press enter to see the output.

2. Copy below script in notepad and save it with the extension .ps1 at location c:\temp, open powershell command prompt go temp folder location with a command cd c:\temp and type the file name having extension .ps1 and press enter to see the output.

$netstat = netstat -aon | Select-String -Pattern “(TCP|UDP)”
$ProcessList = Get-Process
foreach ($line in $netstat)
{
$SpltArry = $line -split ” “
$PD = $spltArry[$spltarry.length 1]
$pn = $ProcessList | Where-Object {$_.id -eq $pd } | select processname
$SpltArry[$SpltArry.length 1] = $PD + ” “ + $PN.processname
$SpltArry -join ” “
}

Output of the script is shown in this figure.

Netstat Process Name