Home » PowerShell » PowerShell Telnet and Alternatives to Telnet Command

PowerShell Telnet and Alternatives to Telnet Command

Telnet protocol is used to establish a remote connection to the remote computer. Telnet provides access to a command-line interface on the remote computer. However, due to security concerns, the Telnet client feature is disabled by default on all versions of the Windows operating system. If you don’t want to enable to Telnet Client feature, there are alternative methods to PowerShell Telnet to test remote computer connections.

If you try to run Telnet in PowerShell, it will throw an exception as ‘Telnet‘ is not recognized as the name of the cmdlet.

In this article, I will explain to you how to use PowerShell Telnet and PowerShell Telnet alternative to test remote host connection over the port.

In all versions of Windows Operating System, the Telnet client is disabled by default because of security reasons.

Let’s understand PowerShell Telnet alternatives to test remote computer connections.

Using Test-NetConnection to Test Connectivity

PowerShell Test-NetConnection cmdlet is used to test connectivity with remote computers and get diagnostics information about the connection.


    [[-ComputerName] <String>]
    [-Hops <Int32>]
    [-InformationLevel <String>]

To test a ping connection to a remote host, use the PowerShell Test-NetConnection command:

Test-NetConnection -ComputerName -InformationLevel "Detailed" -Port 3389

In the above command, the PowerShell Test-Connection command test ping connectivity with the remote computer name specified by ComputerName and Port 3389.

It returns detailed diagnostic information about remote computer connectivity as given below

ComputerName            :
RemoteAddress           :
RemotePort              : 3389
NameResolutionResults   :
MatchingIPsecRules      :
NetworkIsolationContext : Private Network
IsAdmin                 : False
InterfaceAlias          : Wi-Fi
SourceAddress           :
NetRoute (NextHop)      :
TcpTestSucceeded        : True

If PingSucceeded is true, it means the remote computer is reachable over Port 3389 else not reachable. PowerShell Test-Connection test port without telnet.

Using System.Net.Sockets.TcpClient to Test Connectivity

Microsoft .Net System.Net.Sockets.TcpClient provides telnet connectivity to the remote host on a specified port number.

To test connection with remote computer, use the System.Net.Sockets.TcpClient method:

New-Object System.Net.Sockets.TcpClient("", 3389) 

In the above command, the TcpClient method takes the remote computer IP address and port number to test the connection.

It returns detailed diagnostics information about the test connection with a remote computer over the port number below:

Client              : System.Net.Sockets.Socket
Available           : 0
Connected           : True
ExclusiveAddressUse : False
ReceiveBufferSize   : 65536
SendBufferSize      : 65536
ReceiveTimeout      : 0
SendTimeout         : 0
LingerState         : System.Net.Sockets.LingerOption
NoDelay             : False

In the above output,

Connected: True, if the connection to a remote computer over the port is successful

Connected: False, if the connection to a remote computer over the port is unsuccessful.

Cool Tip: How to use Get-AdDomainController to get domain controller in PowerShell!

Using PowerShell Telnet to Test Connection

The Telnet Client is disabled by default on Windows 10 or all Windows versions. To use Telnet in PowerShell, enable the Telnet client feature.

There are two different ways to enable Telnet client in Windows:

Install Telnet Client using Command Prompt (cmd)

To install the Telnet client using cmd, open the command prompt with run as administrator.

Use the command dism with its /Enable-Feature and /FeatureName:TelnetClient to enable the Telnet client feature:

dism /online /Enable-Feature /FeatureName:TelnetClient

In the above command, the dism command is used to repair or modify Windows installation media and its feature. The command uses the Enable-Feature parameter and TelnetClient as FeatureName and enables Telnet client on the Windows operating system to test the port.

Install Telnet Client using PowerShell

To install Telnet client using the PowerShell console, open the terminal with run as administrator.

Install-WindowsFeature cmdlet requires ServerManager to be installed. Install the module using the below command

Import-Module ServerManager

Run the below command in the PowerShell terminal to enable Telnet in PowerShell.

Install-WindowsFeature -name "Telnet-Client"

In the above command, using Install-WindowsFeature, it takes Telnet-Client as the feature name, and on script execution, it enables Telnet in PowerShell to test connection with a remote host over the port.


The Telnet command is very useful for system administrators to test connections over remote computers and test ports if it is used or block ports if they are not in use.

If the PowerShell Telnet client is not enabled, you can enable it using dism or Install-WindowsFeature command. If you don’t want to enable Telnet client feature, there are another telnet alternative to test connection to the remote host using PowerShell Test-Connection and System.Net.Sockets.TcpClient.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

1 thought on “PowerShell Telnet and Alternatives to Telnet Command”

  1. dism /online /Enable-Feature /FeatureName:TelnetClient
    This is the only command that works for my windows 10

Comments are closed.