We can use PowerShell to test remote port connectivity without installing telnet and with the use of the Test-NetConnection command.
To check if the remote port is open or not we can use the Test-NetConnection command and it requires -The computer name parameter and -Port to check the remote port status.
Method 1
- Open PowerShell
- Modify the example command below, replacing IP address (or hostname) and port
Test-NetConnection -ComputerName 192.168.1.1 -Port 443
Test-NetConnection -ComputerName hostname -Port 443
Methord 2
Use the script bellow to check if the port is open.
Create a text File in C:\temp\ with IP.txt. update With the IP address or hostname of the server you are interested in.
Create a text File in C:\temp\ with Ports.txt. update With the portnumber you like to check.
$HOSTFILE = Get-Content "C:\temp\IP.txt"
$PORTFILE = Get-Content "C:\temp\Ports.txt"
foreach ($HOSTLINE in $HOSTFILE)
{
foreach ($PORTLINE in $PORTFILE)
{
$STATUS=(New-Object System.Net.Sockets.TcpClient).ConnectAsync($HOSTLINE, $PORTLINE).Wait(1000)
Write-Output "$HOSTLINE, $PORTLINE, Status: $STATUS"
}
}
pwig71
qp6teb
is6iyg
xpidz8
ucrc8j
kwbgxt
x7ig4m
Very interesting info !Perfect just what I was looking for! “People everywhere confuse what they read in newspapers with news.” by A. J. Liebling.
1446aq
g8sf2q
pmcls4
x0exig
Dead pent articles, appreciate it for information .
As a Newbie, I am continuously searching online for articles that can be of assistance to me. Thank you