Tuesday 12 April 2022

how to show the running and listening ports in windows server locally and on remote server

You can use the netstat command to show the current status of ports in command prompt.

like as below.

Netstat -a 

it will show all the running ports.

But we can use the Get-NetTCPConnection, in windows PowerShell as well, it have some more features.


1:

Get-NetTCPConnection -State Listen,Established

To show the same on remote computer, use the following command

2:

invoke-Command -Computername Server2 -ScriptBlock { Get-NetTCPConnection -State Listen,Established}