Which program/task is using port .. on Windows

Today I ran into the issue that the SMTP server of my beloved Domino server was not able to startup due to the following error message after a reboot of the Windows server:

06.03.2020 08:02:38 SMTP Server: Another application is already listening on port 25: 220 NOTES02 SMTP Server ready
06.03.2020 08:02:38 SMTP Server: Started
06.03.2020 08:02:38 SMTP Server: Listener failure, TCP/IP port number [25] is already in use on this system
06.03.2020 08:02:38 Suspending listen task for 20 seconds due to network errors

So what was causing the SMTP to startup ? To find out just enter the following command in a command prompt window:

netstat -aon | findstr 25

Then you will get all services listening to port *25*

result

With this information you just have to search for PID “8” in the Task Manager and either kill the task or end the service.

taskmgr

There´s also another way I received from Harald Reisinger:

With Powershell: Get-NetTCPConnection -LocalPort 25 | Select-Object -Property @{ Name=’Id’; Expression={$_.OwningProcess}} | Get-Process

Thanks to Harald for sharing this great information !