Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Help pleasePowershell : Script to telnet to test multiple server's

$
0
0

Hello,

 

I am writing to you, I look a little script in powershell for testing:

 

telnet www.s.code42.fr 2345

telnet localhost 23

telnet localhost 10000

 

after the execution should show me if OK for access or Failed to access for the three test.

 

thank you a lot.

 

# test telnet 
param(
    [string] $remoteHost = "s.code42.fr",
    [int] $port = 23
     )
# Open the socket, and connect to the computer on the specified port
write-host "Connecting to $remoteHost on port $port"
try {
  $socket = new-object System.Net.Sockets.TcpClient($remoteHost, $port)
} catch [Exception] {
  write-host $_.Exception.GetType().FullName
  write-host $_.Exception.Message
}
write-host "Connected.`n"

 

This is a code but just for one server , i would for multiple server .

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles