Without talking much, please find the code below.
#------------------------------------------------------------------------------------------
# Script : Check_Port.ps1
# Author : Som DT.
# Purpose : Checking if Port is open on target TCP/IP server from current host
#------------------------------------------------------------------------------------------
function Check-Port([string]$HostName, [string] $PortNumber)
{
#--Set the client --#
$tcp = New-Object System.Net.Sockets.TcpClient
#--Connecting to the Port --#
$tcp.connect($HostName , $PortNumber )
}
Enjoy!
No comments:
Post a Comment