Test-Connection was added in 5328 but it appears that Test-NetConnection is still missing.
Get-Command Test-NetConnection
CommandType Name Version Source
----------- ---- ------- ------
Function Test-NetConnection 1.0.0.0 NetTCPIP
Get-Command : The term 'Test-NetConnection' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Command Test-NetConnection
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-NetConnection:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0-preview.2
PSEdition Core
GitCommitId v6.1.0-preview.2
OS Microsoft Windows 10.0.14393
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
We added Test-Connection - this is new ported cmdlet. Test-NetConnection - this is Windows PowerShell cmdlet from nettcpip module.
I'm a little unclear, does that mean that Powershell 6 will not have Test-NetConnection? I would expect the ability to check a specific port on a system would be of even more interest to unix admins.
My assumption was that, like Test-Connection, Test-NetConnection had also been overlooked. If that was an incorrect assumption, then perhaps this should be re-labeled as a feature request. Otherwise, I believe this is a bug.
@kevinlrak Current Test-Connection ported implementation was enhanced. Please see help Test-Connection.
Get-Help -Name Test-Connection
NAME
Test-Connection
SYNTAX
Test-Connection [-TargetName] <string[]> [-Ping] [-IPv4] [-IPv6] [-ResolveDestination] [-Source <string>]
[-MaxHops <int>] [-Count <int>] [-Delay <int>] [-BufferSize <int>] [-DontFragment] [-TimeoutSeconds <int>]
[-Quiet] [<CommonParameters>]
Test-Connection [-TargetName] <string[]> [-Ping] [-IPv4] [-IPv6] [-ResolveDestination] [-Source <string>]
[-MaxHops <int>] [-Delay <int>] [-BufferSize <int>] [-DontFragment] [-Continues] [-TimeoutSeconds <int>] [-Quiet]
[<CommonParameters>]
Test-Connection [-TargetName] <string[]> -Traceroute [-IPv4] [-IPv6] [-ResolveDestination] [-Source <string>]
[-MaxHops <int>] [-TimeoutSeconds <int>] [-Quiet] [<CommonParameters>]
Test-Connection [-TargetName] <string[]> -MTUSizeDetect [-IPv4] [-IPv6] [-ResolveDestination] [-TimeoutSeconds
<int>] [-Quiet] [<CommonParameters>]
Test-Connection [-TargetName] <string[]> -TCPPort <int> [-IPv4] [-IPv6] [-ResolveDestination] [-Source <string>]
[-TimeoutSeconds <int>] [-Quiet] [<CommonParameters>]
You can to check a specific port too.
.Net Core has still bugs in APIs and not all in Test-Connection works on Unix.
Feel free to test and feedback.
Nettcpip module is not in the repo (another MSFT team is owner) and it is not ported.
@iSazonov what version are you running? I'm on the 6.1.0-preview.2, but my help Test-Connection does not match what you put above. Neither does the online help page for Test-Connection in Powershell 6.
Here is what I get:
SYNTAX
Test-Connection [-ComputerName] <String[]> [-AsJob] [-BufferSize <Int32>] [-Count <Int32>] [-Delay <Int32>] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-ThrottleLimit <Int32>] [-TimeToLive <Int32>] [-DcomAuthentication <AuthenticationLevel>] [-Protocol <String>] [-WsmanAuthentication <String>] [<CommonParameters>]
Test-Connection [-ComputerName] <String[]> [-Source] <String[]> [-AsJob] [-BufferSize <Int32>] [-Count <Int32>] [-Credential <PSCredential>] [-Delay <Int32>] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-ThrottleLimit <Int32>] [-TimeToLive <Int32>] [-DcomAuthentication <AuthenticationLevel>] [-Protocol <String>] [-WsmanAuthentication <String>] [<CommonParameters>]
Test-Connection [-ComputerName] <String[]> [-BufferSize <Int32>] [-Count <Int32>] [-Delay <Int32>] [-Impersonation {Default | Anonymous | Identify | Impersonate | Delegate}] [-Quiet] [-TimeToLive <Int32>] [-DcomAuthentication <AuthenticationLevel>] [-Protocol <String>] [-WsmanAuthentication <String>] [<CommonParameters>]
However, when I try running Test-Connection with the -TCPPort flag, it does seem to function. So I believe this is mostly a problem with that enhancement being undocumented in the latest current release (6.1.0-preview.2)
@kevinlrak It is a trick :-) or bug. You catch Windows PowerShell help. You can find where it is by:
```c#
gcm Test-Connection | fl
I get
DLL : C:UserssieDownloadsPowerShell-6.1.0-preview.9168-win-x64Microsoft.PowerShell.Commands.M
anagement.dll
HelpFile : C:UserssieDocumentsPowerShellHelpen-USMicrosoft.PowerShell.Commands.Management.dll-He
lp.xml
``
After I rename folderC:UserssieDocumentsPowerShellHelp` I get the right help.
In PowerShell 6.0.2, version installed through HomeBrew on a Mac, both commands are missing:
$PSVersionTable
Name Value
---- -----
PSVersion 6.0.2
PSEdition Core
GitCommitId v6.0.2
OS Darwin 17.5.0 Darwin Kernel Version 17.5.0: Fri Apr 13 19:32:32 PDT 2018; root:xnu-4570.51.2~1/RELEA...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
@corretge You'll get Test-Connection in 6.1 version or you can use 6.1 Preview2 or current dev builds.