Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Windows 10 / Find Out Which Process is Listening on a Specific Port on Windows

March 16, 2024

Find Out Which Process is Listening on a Specific Port on Windows

When starting a new service or app on Windows, you may find that another program (process) already occupied (listening) the port you want to use. This article will show you how to find out which process is listening on a specific TCP or UDP port on Windows.

For example, you cannot run an IIS site on the default port 80 because the port is currently busy (if you are running multiple websites in IIS, you can run them on the same or different ports). So, how to find out which service or process is listening on a port and kill it?

To get a complete list of the TCP and UDP ports that your computer is listening on, run the following command:

netstat -aon| find "LIST"

Or you can enter the port number you are looking for:

netstat -aon | findstr ":80" | findstr "LISTENING"

Parameters used in the netstat command:

  • a – show network connections and open ports
  • o – show the Process Identifier (PID) for each connection
  • n – show addresses and port numbers in numeric format

The output of this command shows that TCP port 80 is being listened on (LISTENING state) by the process with PID 16124.

netstat - list open port on windows

You can identify the executable file of a process by its PID using Task Manager or the following command:

tasklist /FI "PID eq 16124"

find process name by PID

You can replace all of the above commands with a one-liner:

for /f "tokens=5" %a in ('netstat -aon ^| findstr :80') do tasklist /FI "PID eq %a"

You can use a PowerShell one-line command to instantly get the name of the process listening on a specific port:

  • TCP port: Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess
  • UDP port: Get-Process -Id (Get-NetUDPEndpoint -LocalPort 53).OwningProcess

The tiny.exe process is listening on port 80 in our case.

powershell -find out which process is listening on a TCP or UDP port

Read the article about how to use PowerShell to view network connections in Windows.

Once you have the process identified, you can terminate it immediately by piping the results to the Stop-Process cmdlet:

Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess| Stop-Process

Check that port 80 is no longer in use:

Test-NetConnection localhost -port 80

how to check the port is not listening

To quickly find the path to the process executable in Windows, use the commands:

cd /
dir tiny.exe /s /p

Or you can use the built-in where command:

where /R C:\ tiny

In our case, we found that the executable tiny.exe (lightweight HTTP server) listening on port 80 is located in the directory c:\Temp\tinyweb\tinyweb-1-94.

find exe file in windows

You can also use the TCPView tool to view the list of processes and the TCP ports they listen to on Windows (https://learn.microsoft.com/en-us/sysinternals/downloads/tcpview).

TCPView - Find the Process Listening to Port on Windows

0 comment
0
Facebook Twitter Google + Pinterest
PowerShellQuestions and AnswersWindows 10Windows 11Windows Server 2019
previous post
Import-CSV: Reading CSV Files with PowerShell
next post
How to Increase Virtual Machine Disk Size in VMware

Related Reading

How to Repair EFI/GPT Bootloader on Windows 10...

March 16, 2024

How to Restore Deleted EFI System Partition in...

March 11, 2024

How to Allow Multiple RDP Sessions on Windows...

March 15, 2024

How to Run Program without Admin Privileges and...

June 8, 2023

Wi-Fi (Internet) Disconnects After Sleep or Hibernation on...

March 15, 2024

How to Install Remote Server Administration Tools (RSAT)...

March 17, 2024

Refresh AD Groups Membership without Reboot/Logoff

March 15, 2024

Network Computers are not Showing Up in Windows...

March 15, 2024

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)
  • Fix: Remote Desktop Licensing Mode is not Configured
  • How to Delete Old User Profiles in Windows
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • Configuring Port Forwarding in Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • Adding Drivers into VMWare ESXi Installation Image
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top