Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a port is in use using powershell

Is there a way in powershell to check if a given port is in use or not?

like image 962
Jeevan Avatar asked Aug 02 '11 10:08

Jeevan


People also ask

How do I ping a port in PowerShell?

In order to ping a specific port using Powershell, you have to use the “Test-NetConnection” command followed by the IP address and the port number to be pinged.

What is netstat in PowerShell?

The netstat command produces tab-delimited, fixed-width tables. The following example converts the active connections that list active TCP connections as well as listening TCP and UDP ports to an object.

How do you check 443 port is enabled or not in Windows?

You can use netstat command to list the tcp port, if 443 port is listed there and state is established means 443 is open for outbound communication.


1 Answers

Use Get-NetTCPConnection

Get-NetTCPConnection | where Localport -eq 5000 | select Localport,OwningProcess

Localport OwningProcess
--------- -------------
    5000          1684
like image 51
mikemaccana Avatar answered Oct 11 '22 19:10

mikemaccana