Determine which process is using a specific port using PowerShell.

If you find that a process is using a TCP port and you want to know which process is using that port it's easy with PowerShell using the Get-NetTCPConnection and Get-Process cmdlets.


# Determine which process is using port 443

$owningProcess = (Get-NetTCPConnection -State Listen -LocalPort 443|SELECT OwningProcess)[0];
$processName = Get-Process -Id $owningProcess.OwningProcess|SELECT ProcessName;
Write-Host "Port 443: $($processName.ProcessName)";





Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Windows Server 2019 desktop icons such as My Computer, Windows cannot access the specified device, path, or file.