Проверка tcp порта в windows

Checking open TCP/IP ports on your Windows computer is crucial for managing network security and ensuring smooth connectivity. Certain apps and processes in Windows may face issues due to closed or misconfigured ports, often caused by firewalls or private IP addresses. This guide will walk you through step-by-step methods to check whether a TCP port is open or closed using built-in tools and third-party utilities.

Why You Should Check TCP/IP Ports?

Here are some common scenarios where checking ports is necessary:

  • Troubleshooting connectivity issues for applications or services.
  • Configuring firewalls to ensure necessary connections are allowed.
  • Detecting suspicious activity that might indicate a security breach.

Methods to Check Open TCP/IP Ports

There are several ways to check open TCP/IP ports in Windows. Here are a few options:

Method 1. Using Telnet Client

Step 1: Check whether the telnet client feature is ON or not. In order to check, open the Turn Windows feature on or off settings from the search bar. OR press the ‘window’ key and type ‘windows’ features. Then press on “Turn Windows features on or off”.

Windows Features Option

A new prompt will be opened. Search for “Telnet Client” and check the box in front of ‘telnet Client’.

Windows Features

Step 2: Open the command prompt. Press the ‘windows’ key and type ‘cmd’. Press “Command Prompt”.

Command Prompt Option

Step 3: On the command prompt, type the command “telnet + IP address or hostname + port number” and check the status of the provided TCP port.

Telnet Command

Step 4: If only the blinking cursor is visible, then the port is open.

Port is Open

Step 5: If you get the message “connection failed” then the port is closed.

Port is close

Method 2: Using built-in netstat command-line utility:

Step 1: Open the command prompt. 

Step 2: Run the following command:

netstat -an

Method 3. Using TcpView

Another option is to use the TcpView utility from Microsoft’s Sysinternals suite of tools. This utility provides a more user-friendly interface for viewing active TCP/IP connections, along with additional information such as the process ID and process name for each connection. Steps to be followed:

Step 1: Download the TcpView utility from the Microsoft Sysinternals website. You can find the download link on the TcpView page of the Sysinternals website.

Download Page

Step 2: Extract the downloaded file and run the TcpView.exe file to launch the TcpView utility. This will open the TcpView window, which shows a list of all active TCP/IP connections on your machine.

Extracted FIles

Step 3: Open the tcpview.exe (application).

By default, TcpView will display the following columns in the list of connections:

Protocol: Shows the protocol being used for the connection (TCP or UDP)

Local Address: Shows the local address and port being used for the connection

Remote Address: Shows the remote address and port being connected to

State: Shows the current state of the connection (e.g. Established, Listen, etc.)

You can use the “Local Address” and “Remote Address” columns to see which ports are being used by which applications. For example, if you see a connection with a local address of “127.0.0.1:80”, this means that the local application is using port 80 for outgoing connections.

Method 4. Using Windows PowerShell

You can also use Windows PowerShell to check open TCP/IP ports. To do this, use the Get-NetTCPConnection cmdlet, which allows you to view a list of active TCP/IP connections and the local and remote addresses and ports being used. For example, you can run the following command to view a list of all active TCP/IP connections:

Get-NetTCPConnection | 
Select-Object LocalAddress,
LocalPort, RemoteAddress, RemotePort

Get-NetTCPConnection cmdlet

Method 5. Using Nmap

To install Nmap in the Windows command line, follow these steps:

Step 1: Download the latest version of Nmap from the Nmap website. You can find the download link on the Nmap download page: 

https://nmap.org/download.html

Step 2: Extract the downloaded file to a location on your computer. This will create a new folder containing the Nmap files.

Step 3: Open a command prompt and navigate to the directory where you extracted the Nmap files. For example, if you extracted the files to the C:\nmap directory, you would run the following command:

cd C:\nmap

Step 4: Once you are in the Nmap directory, you can install Nmap by running the nmap.exe file. To do this, run the following command:

nmap.exe -V

This will display the version number of Nmap, indicating that it has been installed successfully.

Step 5: To use nmap to scan for open TCP/IP ports, run the “nmap -sT” command, followed by the IP address or hostname of the machine you want to scan.

nmap -sT localhost

This will scan the specified host or IP address and display the results. You can also use the -h option to view a list of available options and arguments for the nmap command. Overall, installing Nmap in the Windows command line is a straightforward process. You can download the latest version of Nmap from the Nmap website, extract the files, and then run the nmap.exe file to install it. Once it is installed, you can use the nmap command to scan hosts and IP addresses and view the results.

Common Issues That Close Ports

  • Applications not functioning as expected.
  • Misconfigured firewall rules blocking connections.
  • IP addresses improperly set as private.

Troubleshooting Common Issues

Here are some common issues that may occur during opening TCP/IP Ports in Windows:

  • Telnet Not Listed in Features: Ensure your system version supports Telnet or enable it via PowerShell.
  • Firewall Blocking Ports: Temporarily disable the firewall to test port connectivity.
  • Command Not Recognized: Verify tool installation and environment variables.

Conclusion

Checking open TCP/IP ports on your Windows computer is an important step for maintaining your system’s security and efficiency. By regularly monitoring these ports, you can identify any unwanted or suspicious connections that might put your computer at risk. Windows provides several simple tools, like Command Prompt and PowerShell, which make it easy to see which ports are open and what applications are using them. Taking the time to check your open ports helps ensure that your computer runs smoothly and stays protected from potential threats. Staying proactive about monitoring your network connections is a key part of keeping your digital environment safe and reliable.

Windows Netstat Command to Check Open Ports in Windows

In this tutorial, we will learn how to run the netstat command to check open ports in Windows Operating System. We will also look at command options and how to use the findstr command (similar to grep) to filter the netstat output.

To check open ports, open a command prompt (or PowerShell) as administrator and run the netstat command as follows:

netstat -aon

The command displays lots of information. What you should pay attention to are Local Addresses that are in the LISTENING state.

check if port is open windows

As you can see in the previous screenshot, In my Windows 10 computer, port 22 (SSH) is open.

Administrators can run the following command to show opened ports only without all other details:

netstat -aon | findstr /i listening

One important point is that the Windows Firewall may block a port even if it is in the listening state. In the Windows Defender Firewall with Advanced Security, there has to be a corresponding inbound firewall rule to match the listening port (Anything with a green checkmark is an open rule).

listening ports windows firewall

The Foreign Address column of the output shows the IP address and port of the computer/server at the remote end of the connection.

To check that the port is open from a remote computer, an administrator can run the telnet command from a remote computer against the IP address of the Windows computer.

For example, to check if port 22 is open, I will run the telnet command from a remote computer as follows:

telnet IP_ADDRESS 22

Replace IP_ADDRESS with the actual IP Address of the Windows computer.

check if port is open from a remote computer

Filtering netstat using findstr

Administrators can use the findstr CMD command (which is similar to grep) to filter netstat command data based on string patterns.

For example, run the following command to check TCP connections in TIME_WAIT State.

netstat -a | findstr /i TIME_WAIT

The /I option is for the case insensitive matching.

cmd netstat command to check open ports in windows

Command Options

Windows netstat command, without any command-line arguments, displays active TCP connections.

It also includes some useful command options to show network connections and ports in various forms, such as show connections and opened ports based on the protocol, find the process id of a connection/port, view network statics, and find the application that utilizes connections and ports.

-a displays all network connections and ports on which Windows is listening (include both IPv4 or IPv6 addresses).
-b The output shows you which applications are using each active connection and ports (need administrative privileges).
-e Displays network statistics, such as the Errors, the number of bytes, and packets sent and received.
-n Displays addresses and ports in numerical format.
-f When used, the output will contain Fully Qualified Domain Names (FQDNs) of IP addresses, if available.
-o Displays an additional column that contains the Process ID (PID).
-p Display data for a specific protocol (e.g., -p TCP). The Protocol can be one of the following: TCP, UDP, TCPv6, or UDPv6. If combined with the -s option, Protocol can be TCP, UDP, ICMP, IP, TCPv6, UDPv6, ICMPv6, or IPv6.
-r Check Windows routing table.
-s Displays detailed network statistics for each protocol (IPv4, IPv6, ICMPv4, ICMPv6, TCP, and UDP).
interval Sets Time interval (in seconds) to automatically update the output. See examples to learn more.

Examples: Using the netstat command

List all Active TCP connections:

netstat

Check open ports:

netstat -aon | findstr /i listening

Only want to see information about TCP protocol:

netstat -a -p tcp

Show network statistics:

netstat -s

Real-time network monitoring — In the following example, we set a 5 second time interval to check active network connections in real-time. The number 5 causes the command to repeat every five seconds (Press CTRL+C to quit).

netstat -n 5

If you need more information about the Windows netstat command, type netstat \? in the command prompt.

Quick Links

  • Use Built-In Tools to See What Is Listening on a Port

  • Use NirSoft CurrPorts to View What is Listening on a Port

Summary

  • Run the command «netstat -ab» in an elevated Command Prompt, PowerShell, or Terminal window to see a list of applications and their associated ports. This works in Windows 11 too.
  • Checking open ports can be done using built-in tools like Command Prompt or PowerShell, which list active ports and the associated process names or identifiers.
  • The freeware application CurrPorts by NirSoft provides an easier way to view what is listening on a port, displaying detailed information about the process and allowing for better management of ports.

Whenever an application wants to make itself accessible over the network, it claims a TCP/IP port, which means that port can’t be used by anything else. So how do you check open ports to see what application is already using it?

We’ve tested this process and confirmed that all of the steps are up-to-date, and that they all work in Windows 11, too.

How Do Ports Work?

An IP address specifies a computer — or other network device — on a network. When one device sends traffic to another, the IP address is used to route that traffic to the appropriate place. Once the traffic reaches the right place, the device needs to know which app or service to send the traffic on to. That’s where ports come in.

If the IP address is akin to a street address on a piece of mail, the port is something like the name of the person at that residence who gets the mail. For the most part, you don’t need to worry about ports. But once in a while, you might encounter an app that’s set to listen for traffic on the same port that another app already has in use. In that case, you’ll need to identify the app that already has that port in use.

There are a number of ways to tell what application has a port locked, but we’re going to walk you through a couple of built-in ways that use the Command Prompt, PowerShell, or the Terminal, and then show you a great freeware application that makes it even easier. All these methods should work no matter which version of Windows you use.

We’ve got two commands to show you. The first lists active ports along with the name of the process that’s using them. Most of the time, that command will work fine. Sometimes, though, the process name won’t help you identify what app or service actually has a port tied up. For those times, you’ll need to list active ports along with their process identifier numbers and then look those processes up in Task Manager.

Option One: View Port Use Along with Process Names

First, you’ll need to open the Command Prompt in administrator mode. Hit Start, and then type «command» into the search box. When you see «Command Prompt» appear in the results, right-click it and choose «Run as administrator,» or click «Run as Administrator» on the right.

You can also use PowerShell or Terminal for this.

Enter "Command Prompt" into the Start Menu search, then right-click the "Command Prompt" result and click "Run as Administrator" or click "Run as Administrator" on the right-hand side.

At the Command Prompt, type the following text and then hit Enter:

netstat -ab

After you hit Enter, the results may take a minute or two to fully display, so be patient. Scroll through the list to find the port (which is listed after the colon to the right of the local IP address), and you’ll see the process name listed under that line. If you’d like to make things a little easier, remember that you can also pipe the results of the command to a text file. You could then just search the text file for the port number you’re after.

Here, for example, you can see that port 49902 is tied up by a process named picpick.exe. PicPick is an image editor on our system, so we can assume the port is actually tied up by the process that regularly checks for updates to the app.

The port 49902 is being used by the process "picpick.exe."

Option Two: View Port Use Along with Process Identifiers

If the name of the process for the port number you’re looking up makes it difficult to tell what the related app is, you can try a version of the command that shows process identifiers (PIDs) rather than names. Type the following text at the Command Prompt, and then hit Enter:

netstat -aon

The column at the far right lists PIDs, so just find the one that’s bound to the port that you’re trying to troubleshoot.

The Process IDs associated with a given port.

Next, open up Task Manager by right-clicking any open space on your taskbar and choosing «Task Manager.» You can also hit Ctrl+Shift+Esc.

Right-click empty space on the taskbar, then click "Task Manager."

If you’re using Windows 8, 10, or 11 switch to the «Details» tab in Task Manager.

In older versions of Windows, you’ll see this information on the «Processes» tab. Sort the list of process by the «PID» column and find the PID associated with the port you’re investigating. You might be able to tell more about what app or service has the port tied up by looking at the «Description» column.

Sort by Process ID (PID), then find the associated application.

If not, right-click the process and choose «Open file location.» The location of the file will likely give you clues as to what app is involved.

Right-click the process and click "Open File Location."

When Once you’re there, you can use the End Process, Open File Location, or Go to Service(s) options to control the process or stop it.

Use NirSoft CurrPorts to View What is Listening on a Port

If you aren’t really the Command Prompt type — or you’d rather just use a simple utility to do all this in one step — we recommend the excellent freeware CurrPorts utility by NirSoft. Go ahead and download the tool. Just make sure you get the right version (the regular version is for 32-bit Windows and the x64 version is for 64-bit Windows). It’s a portable app, so you won’t need to install it. Just unzip the download folder and run executable.

In the CurrPorts window, sort by the «Local Port» column, find the port you’re investigating, and you can see everything — the process name, PID, port, the full path to the process, and so on.

CurrPorts by Nirsoft is can be sorted by which local port is open.

To make it even easier, double-click on any process to see every single detail in one window.

The details of a process in CurrPort.


When you’ve determined what app or service has the port you’re investigating tied up, it’s up to you how to handle it. If it’s an app, you may have the option to specify a different port number. If it’s a service — or you don’t have the option to specify a different port number — you’ll likely have to stop the service or remove the app.

Sometimes it’s worth finding out which TCP/IP ports are open on your device. For example, let’s say your device is communicating with another PC, but the connection suddenly gets interrupted. In this case, you can check all the open TCP/IP ports. From there, you could try to resolve the issue at hand by troubleshooting any faulty port.

This article covers the various ways to check active TCP/IP ports on Windows. But first, let’s find out how these ports work.

What Are TCP/IP Ports, and How Do They Work?

An illustration of questions and answers

Let’s break down the “TCP/IP” term and explain what it means.

TCP (Transmission Control Protocol) refers to a connection-oriented protocol. And in simple terms, protocols are the rules that determine how data is transferred between devices.

Meanwhile, the «IP» (Internet Protocol) part refers to the internet protocol address. This is a unique value assigned to a network device, and it’s used to identify that particular device.

Now, TCP/IP ports are simply the ports that ensure that all the data you send reaches its recipient. These ports ensure that internet-connected devices can communicate with each other. Some examples of TCP/IP ports include the IMAP port (143) for emails and the File Transfer Protocol ports (20 and 21).

Let’s now explore the various ways to check active TCP/IP ports.

1. Check the Open TCP/IP Ports and Their Process Names Using the Command Prompt

A person typing commands on a laptop

When checking the TCP/IP ports that are open, you might also want to discover some additional information.

For example, let’s say you want to check out active TCP/IP ports along with their process names. In such an instance, you can apply these methods:

  1. Press Win + R to open the Run command dialog box.
  2. Type CMD and press Ctrl + Shift + Enter to open an elevated Command Prompt.
  3. Type the following command and press Enter.
netstat -ab

The results will display four columns: Proto, Local Address, Foreign Address, and State.

Checking the TCP-IP ports that are open

The process names are the values displayed in square brackets below the port names.

For example, you might see the “[svchost.exe]” process name under one of the TCP ports.

2. Check the Open TCP/IP Ports and the Process Identifiers Using the Command Prompt

Person using a Windows PC

In some instances, you might want to check out the TCP/IP ports along with their Process Identifiers (the unique numbers that identify processes). This method could be useful if you can’t find the process names using the previous method.

When you’re done searching for the Process Identifier (PID) on Windows, you can check out the task name linked to the PID in the Task Manager.

Let’s start by checking out how to check the open TCP/IP ports and their PIDs:

  1. Press Win + R to open the Run command dialog box.
  2. Type CMD and press Ctrl + Shift + Enter to open an elevated Command Prompt.
  3. Type the following command and press Enter.
netstat -aon

Your screen should display five columns: Proto, Local Address, Foreign Address, State, and PID.

Checking TCP-IP ports and process identifiers

Once you’ve found the PID of a certain port, here’s how you can use the Task Manager to find the task linked to that PID:

  1. Type Task Manager in the Start menu search bar and select the Best match.
  2. Navigate to the Details tab.
  3. Look for your PID value in the PID section and locate the task name from the results on the left.
Checking the PID value and task name on the Task Manager

3. Check Which TCP/IP Ports Are Open Using Third-Party Apps

If you’re a fan of third-party apps, here are some tools that can help you check active TCP/IP ports on your device.

TCPView

The TCPView Tool

The TCPView app shows a detailed list of all the TCP and UDP (User Datagram Protocol) ports. It also shows you the Process Name, Process IDs (PIDs), the Local Address, the Remote Address, the Local Port, the Remote Port, and more.

You can customize the TCPView screen by clicking the View tab and selecting the relevant option.

If you’d like to change the window to dark mode, head to the Options tab, select Theme, and then pick the Dark option. You can also tweak other settings (such as changing the font size) on the Options tab.

And if you’d like to close one of the processes on the screen, select the process in question, click the Process tab, and then select the Kill… option.

If you want to edit a process, click on the process in question, click the Edit tab, and then select the relevant option. And if you need some assistance, head to the Help tab.

Download: TCPView for Windows (Free)

CurrPorts

The CurrPorts Tool

CurrPorts almost looks similar to TCPView, but it has a couple of additional tabs that display critical information. For example, this tool also shows you the Process Path (file path), the Product Name, the File Description, and the File Version (for apps).

The tool displays all the open TCP/IP and UDP ports on your PC.

If you want to close some ports, highlight them and then click the “close” icon. To filter your results, click the “filter” icon, select your filter, and then click OK.

If you want to search for specific ports, click the “find” icon, type the name of the port, and then click Find Next.

To edit your ports, navigate to the Edit tab and then select the relevant option.

If you want to customize the CurrPorts tool, click the View tab and select the relevant option. And if you want to discover more customization features, head to the Options tab.

Download: CurrPorts for Windows (Free)

TCP Monitor Plus

The TCP Monitor Plus Tool

TCP Monitor Plus comprises 11 tabs that you can use for various purposes. But in this case, we’ll focus on the Session Monitor tab because that’s where the TCP/IP information is located.

Once you’re on the Session Monitor tab, you should see various sections containing information about the TCP/IP ports. The «Status» tab tells you whether the ports are open or connecting. The other tabs display information such as the IP address, hostname, process name, and more.

If you want to make changes to a specific port, right-click on it and select a relevant option.

Download: TCP Monitor Plus for Windows (Free)

Finding All Your Active TCP/IP Ports Shouldn’t Be Difficult

Are you communicating with a remote computer but suddenly run into connection issues? Maybe the problem comes from TCP/IP ports. In this case, you can simply check which TCP/IP ports are open using the tips we’ve covered. From there, you can apply the relevant troubleshooting steps to fix the faulty port.

And if you run into other problems while connecting to a remote device, check out some common remote desktop connection issues and their fixes.

В PowerShell для проверки доступности порта на удаленном компьютере можно использовать командлет Test-NetConnection. Этот командлет позволяет проверить доступность удаленного сервера или службы на нем, протестировать блокируется ли TCP порт файерволами, проверить доступность по ICMP и маршрутизацию. По сути, командлет Test-NetConnection позволяет заменить сразу несколько привычных сетевых утилит: ping, traceroute, telnet, сканер TCP портов и т.д.

Содержание:

  • Проверка доступности TCP порта с помощью Test-NetConnection
  • PowerShell: проверка открытых портов на нескольких IP хостах
  • IP сканер сети на PowerShell
  • Вывести список открытых портов в Windows

Проверка доступности TCP порта с помощью Test-NetConnection

Командлет Test-NetConnection можно использовать только для проверки TCP портов. Например, чтобы проверить, что на почтовом сервере открыт порт TCP 25 (SMTP протокол), выполните команду:

Test-NetConnection -ComputerName msk-msg01 -Port 25

Примечание. С помощью командлета Test-NetConnection можно проверить только TCP соединение, для проверки доступности UDP портов он не применим.

В сокращенном виде аналогичная команда выглядит так:

TNC msk-mail1 -Port 25

Test-NetConnection - прверка ответа от TCP порта

Разберем результат команды:

ComputerName : msk-msg01 RemoteAddress : 10.10.1.7 RemotePort : 25 InterfaceAlias : CORP  

SourceAddress : 10.10.1.70 PingSucceeded : True PingReplyDetails (RTT) : 0 ms TcpTestSucceeded : True 

Как вы видите, командлет выполняет разрешение имени сервера в IP адрес, выполняется проверка ответа ICMP (аналог ping) и проверка ответа от TCP порта (доступность). Указанный сервер доступен по ICMP (
PingSucceeded = True
) и 25 TCP порт также отвечает (
RemotePort=25, TcpTestSucceeded= True
).

Примечание. Если команда вернула PingSucceeded=False и TcpTestSucceeded= True, скорее всего означает, что на удаленном сервере запрещен ICMP Ping.

Если выполнить команду Test-NetConnection без параметров, выполнится проверка наличия подключения к интернету на компьютере (проверяется доступность узла internetbeacon.msedge.net):

Test-NetConnection проверить достуа в интернет на компьютере

Для вывода детальной информации при проверки удаленного TCP порта можно добавить опцию -InformationLevel Detailed:

TNC 192.168.31.102 -Port 3389 -InformationLevel Detailed

test-netconneciton detailed - подробная информация о доступности удаленного порта

Доступность популярных сервисов Windows на удаленном компьютере (HTTP, RDP, SMB, WINRM) можно проверить с помощью параметра CommonTCPPort.

Например, чтобы проверить доступность веб-сервера, можно использовать команду:

Test-NetConnection -ComputerName winitpro.ru -CommonTCPPort HTTP

Или проверить доступность стандартного RDP порта (TCP/3389):

Test-NetConnection msk-rds1 –CommonTCPPort RDP

Можно вывести все параметры, которые возвращает командлет Test-NetConnection:

Test-NetConnection msk-man01 -port 445|Format-List *

Test-NetConnection все свойства

Если нужна только информация по доступности TCP порта, в более лаконичном виде проверка может быть выполнена так:

TNC msk-mail1 -Port 25 -InformationLevel Quiet

Командлет вернул True, значит удаленный порт доступен.

TNC InformationLevel Quiet

Совет. В предыдущих версиях Windows PowerShell (до версии 4.0) проверить доступность удаленного TCP порта можно было так:

(New-Object System.Net.Sockets.TcpClient).Connect('msk-msg01', 25)

New-Object System.Net.Sockets.TcpClient

Командлет Test-NetConnection можно использовать для трассировки маршрута до удаленного сервера при помощи параметра –TraceRoute (аналог команды трассировки маршрута tracert). С помощью параметра –Hops можно ограничить максимальное количество хопов при проверке.

Test-NetConnection msk-man01 –TraceRoute

Командлет вернул сетевую задержку при доступе к серверу в миллисекундах (
PingReplyDetails (RTT) : 41 ms
) и все IP адреса маршрутизаторов на пути до целевого сервера.

Test-NetConnection TraceRoute

PowerShell: проверка открытых портов на нескольких IP хостах

С помощью PowerShell можно проверить доступность определенного порта на нескольких компьютерах. Сохраните список серверов или IP адресов в текстовый файл servers.txt.

Например, ваша задача – найти сервере на которых не отвечает или закрыт порт TCP/25:

Get-Content c:\Distr\servers.txt |  where { -NOT (Test-Netconnection $_ -Port 25  -InformationLevel Quiet)}| Format-Table –AutoSize

Вы можете использовать PowerShell в качестве простейшую систему мониторинга, которая проверяет доступность серверов и выводит уведомление, если один из серверов недоступен.

Например, вы можете проверить доступность основных служб на всех контроллерах домена в AD (список DC можно получить командлетом Get-ADDomainController). Проверим следующие службы на DC (в утилите PortQry есть аналогичное правило Domain and trusts):

  • RPC – TCP/135
  • LDAP – TCP/389
  • LDAP – TCP/3268
  • DNS – TCP/53
  • Kerberos – TCP/88
  • SMB – TCP/445

$Ports = "135","389","636","3268","53","88","445","3269", "80", "443"
$AllDCs = Get-ADDomainController -Filter * | Select-Object Hostname,Ipv4address
ForEach($DC in $AllDCs){
Foreach ($P in $Ports){
$check=Test-NetConnection $DC.Ipv4address -Port $P -WarningAction SilentlyContinue
If ($check.tcpTestSucceeded -eq $true)
{Write-Host $DC.hostname $P -ForegroundColor Green -Separator " => "}
else
{Write-Host $DC.hostname $P -Separator " => " -ForegroundColor Red}
}
}

Скрипт проверит указанные TCP порты на контроллерах домена, и, если один из портов недоступен, выделит его красным цветом (можно запустить данный PowerShell скрипт как службу Windows).

powershell: test-netconnection проверить порты на конроллерах домена

IP сканер сети на PowerShell

Вы можете реализовать простой IP сканер, которые сканирует удаленные хосты или IP подсети на открытые/закрытые TCP порты.

Чтобы просканировать диапазон IP адресов с 10.10.10.5 до 10.10.10.30 и вывести компьютеры, на которых открыт порт 3389:

foreach ($ip in 5..30) {Test-NetConnection -Port 3389 -InformationLevel "Detailed" 10.10.10.$ip}

Можно просканировать диапазон TCP портов (от 1 до 1024) на указанном сервере:

foreach ($port in 1..1024) {If (($a=Test-NetConnection srvfs01 -Port $port -WarningAction SilentlyContinue).tcpTestSucceeded -eq $true){ "TCP port $port is open!"}}

powershell сканирование открытых сетевых портов

Вывести список открытых портов в Windows

Если вам нужно вывести список портов, открытых на локальном компьютере, исопльзуется командлет Get-NetTCPConnection (это PowerShell-эквивалент NETSTAT). Полный список открытых портов на компьютере можно вывести так:

Get-NetTcpConnection -State Listen | Select-Object LocalAddress,LocalPort| Sort-Object -Property LocalPort | Format-Table

Если вам нужно проверить, какая программа (процесс) слушает определенный порт на вашем компьютере, выполните команду:

Get-Process -Id (Get-NetTCPConnection -LocalPort 443).OwningProcess | ft Id, ProcessName, UserName, Path

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Обрывается установка windows 10
  • Как создать панель задач в windows 10
  • Task sequence windows update
  • Удаление временных файлов в windows 10 через командную строку
  • Пропадает звук блютуз наушники windows 10