PowerShell - Check Remote server and port if open
- Jon Boyette
- Jan 10, 2022
- 1 min read
Save as a .ps1 and prompts for the servername, then the port to check if it is listening
$targetServer= Read-Host "Enter ServerName to Check Port"
$targetPort= Read-Host "Enter Port to check if Listening"
echo ((new-object Net.Sockets.TcpClient).Connect($targetServer,$targetPort)) "$targetPort is
open on $targetServer."
Comments