Test-Connection is related to /usr/bin/ping?
See original GitHub issueis depends on
Can’t change.
Test-Connection
does not work at all if in linux distribution /usr/bin/ping
or /bin/ping
has suid.
Steps to reproduce
stat -c %a /usr/bin/ping # test stat of ping
Test-Connection localhost # Status is Timeout
ping -c 4 localhost # Fine
Expected behavior
Working Test-Connection
Actual behavior
> Test-Connection localhost
Destination: localhost
Ping Source Address Latency BufferSize Status
(ms) (B)
---- ------ ------- ------- ---------- ------
1 mymsi * * * TimedOut
2 mymsi * * * TimedOut
3 mymsi * * * TimedOut
4 mymsi * * * TimedOut
> Test-Connection google.com
Test-Connection: Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
Test-Connection: Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
Test-Connection: Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
Test-Connection: Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
> Get-Error
Exception :
Type : System.Net.NetworkInformation.PingException
Message : Testing connection to computer 'google.com' failed: An exception occurred during a Ping request.
InnerException :
Type : System.Net.NetworkInformation.PingException
TargetSite :
Name : MoveNext
DeclaringType : System.Net.NetworkInformation.Ping+<SendWithPingUtilityAsync>d__76, System.Net.Ping, Version=5.0.0.0, Culture=neutral, PublicKeyToke
n=b03f5f7f11d50a3a
MemberType : Method
Module : System.Net.Ping.dll
StackTrace :
at System.Net.NetworkInformation.Ping.SendWithPingUtilityAsync(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)
at System.Net.NetworkInformation.Ping.SendPingAsyncCore(IPAddress address, Byte[] buffer, Int32 timeout, PingOptions options)
at System.Net.NetworkInformation.Ping.SendPingAsyncInternal(IPAddress address, Int32 timeout, Byte[] buffer, PingOptions options)
Message : An exception occurred during a Ping request.
Source : System.Net.Ping
HResult : -2146233079
HResult : -2146233079
TargetObject : google.com
CategoryInfo : ResourceUnavailable: (google.com:String) [Test-Connection], PingException
FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand
InvocationInfo :
MyCommand : Test-Connection
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 49
Line : Test-Connection google.com
PositionMessage : At line:1 char:1
+ Test-Connection google.com
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Test-Connection
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
Environment data
Name Value
---- -----
PSVersion 7.1.2
PSEdition Core
GitCommitId 7.1.2
OS Linux 5.10.15-172.current #1 SMP PREEMPT Fri Feb 12 16:35:57 UTC 2021
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
# Any Linux distribution there `*bin/ping` has suid (4755)
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
e22624.pdf
This software and related documentation are provided under a license agreement containing restrictions on ... connection, click Test Connection.
Read more >SLES 12 SP5 | Security and Hardening Guide
This manual introduces the basic concepts of system security on SUSE Linux Enterprise Server. It covers extensive documentation about the authentication ...
Read more >Security and Hardening Guide
Try to keep the most important network-related packages up-to-date ... To check whether the LDAP connection works, click Test Connection.
Read more >Oracle Enterprise Manager Grid Control Basic Installation Guide
This software and related documentation are provided under a license agreement containing restrictions on ... To test the connection, click Test Connection.
Read more >Oracle 10g Enterprise Manager Grid Control Installation ...
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and ... and click Test Connection to verify the monitoring credentials.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The response you get from the ping.Send() method is the same as the test-connection one there; Test-Connection just formats it a bit before outputting it, more or less.
But yeah, I think this is a .NET issue and the issue should be filed over there instead. Not really sure what they were thinking, having a dependence on a native util that doesn’t even give the information that their PingReply object claims to provide. 😕
That makes a lot of sense as to why pings on Unix are so tricky to work with. Sigh. Would have been a lot more usable in a number of respects if they’d written a proper ping util into .NET instead of trying to reuse an on-box utility like that. 😔