I use this if telnet is not layin’ around – mainly to test if a computer is reachable on a specific TCPport.
try { $portquery = New-Object System.Net.Sockets.TcpClient("SERVERNAME", PORTNUMBER) $portquery.Close() return $true } catch [system.exception] { return $false }
- F