Bug in Test-NetConnection gives both "PingSucceeded: False" and "TcpTestSucceeded : True" but "PingSucceeded: True" without -Port

Sean 1 Reputation point
2021-02-09T18:53:06.453+00:00

On Windows 10 using Powershell 5.1 the Test-NetConnection looks like it has a bug when invoked using the -Port parameter. The cmdlet Test-NetConnection gives both "PingSucceeded: False" and "TcpTestSucceeded : True" despite the fact the target host does respond to ICMP-- however when provided only -Computername $IPAddress then it returns "PingSucceeded: True" which is correct. It appears that a successful result when using -Port affects how the cmdlet reports PingSucceeded. When the port is closed, then it reports "PingSucceeded: True" This behavior happens when using either IP address or FQDN for -Computername. Can anyone confirm if this is by design? Seems more like a bug.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,462 questions
{count} votes