PowerShell: Simulate endpoint

To test if a port is accessible without required application is running you may run following.

$Port = 80
$Endpoint = New-Object System.Net.IPEndPoint ([ipaddress]::parse('0.0.0.0'),$Port)
$Listner = New-Object System.Net.Sockets.TcpListener $Endpoint
$Listner.Start()

To stop the listner just simple type

$Listner.Stop()

Leave a Reply

Your email address will not be published.