Below is a quick way to perform a telnet session on a server that is not allowed to have the telnet client for some reason(compliance).
## Create Socket Object
$Socket=New-ObjectNet.Sockets.TcpClient# Suppress error messages
$ErrorActionPreference=‘SilentlyContinue‘# Try to connect
$Socket.Connect(“192.168.1.5”,“443”)
if ($Socket.Connected)
{
write-host“Port 443 is open”$Socket.Close() ## Destroy the connection
}
else
{
write-host“Port 443 is not open”
}