Skip to content

Test-Connection -Traceroute doesn't show hostnames at all #11334

@vexx32

Description

@vexx32

Steps to reproduce

Test-Connection 1.1.1.1 -Traceroute

Expected behavior

Intermediate hops are shown with their respective hostnames / IP addresses, where available.

   Target: 1.1.1.1

Hop Hostname                  Ping Latency Status           Source       TargetAddress
                                      (ms)
--- --------                  ---- ------- ------           ------       -------------
  1 172.20.0.1                   1       1 Success          Lira         1.1.1.1
  1 172.20.0.1                   2       2 Success          Lira         1.1.1.1
  1 172.20.0.1                   3       2 Success          Lira         1.1.1.1
  2 12.108.153.193               1       3 Success          Lira         1.1.1.1
  2 12.108.153.193               2       3 Success          Lira         1.1.1.1
  2 12.108.153.193               3       2 Success          Lira         1.1.1.1
  3 12.244.85.177                1      14 Success          Lira         1.1.1.1
  3 12.244.85.177                2      12 Success          Lira         1.1.1.1
  3 12.244.85.177                3      16 Success          Lira         1.1.1.1
  4 *                            1      15 DestinationNetw… Lira         1.1.1.1
  4 *                            2       * TimedOut         Lira         1.1.1.1
  4 *                            3      16 DestinationNetw… Lira         1.1.1.1
  5 *                            1       * TimedOut         Lira         1.1.1.1
  5 *                            2      18 DestinationNetw… Lira         1.1.1.1
  5 *                            3       * TimedOut         Lira         1.1.1.1
  6 *                            1      13 DestinationNetw… Lira         1.1.1.1
  6 *                            2       * TimedOut         Lira         1.1.1.1
  6 *                            3      15 DestinationNetw… Lira         1.1.1.1
  7 *                            1       * TimedOut         Lira         1.1.1.1
  7 *                            2       * TimedOut         Lira         1.1.1.1
  7 *                            3       * TimedOut         Lira         1.1.1.1
  8 *                            1       * TimedOut         Lira         1.1.1.1
  8 *                            2       * TimedOut         Lira         1.1.1.1
  8 *                            3       * TimedOut         Lira         1.1.1.1
  9 4.16.234.182                 1      23 Success          Lira         1.1.1.1
  9 4.16.234.182                 2      23 Success          Lira         1.1.1.1
  9 4.16.234.182                 3      27 Success          Lira         1.1.1.1
 10 1.1.1.1                      1      24 Success          Lira         1.1.1.1
 10 1.1.1.1                      2      24 Success          Lira         1.1.1.1
 10 1.1.1.1                      3      22 Success          Lira         1.1.1.1

Actual behavior

All hostnames are empty, although pings succeed and IP addresses for each response are available in the object.

   Target: 1.1.1.1

Hop Hostname                  Ping Latency Status           Source       TargetAddress
                                      (ms)
--- --------                  ---- ------- ------           ------       -------------
  1 *                            1       1 Success          Lira         1.1.1.1
  1 *                            2       2 Success          Lira         1.1.1.1
  1 *                            3       2 Success          Lira         1.1.1.1
  2 *                            1       3 Success          Lira         1.1.1.1
  2 *                            2       3 Success          Lira         1.1.1.1
  2 *                            3       2 Success          Lira         1.1.1.1
  3 *                            1      14 Success          Lira         1.1.1.1
  3 *                            2      12 Success          Lira         1.1.1.1
  3 *                            3      16 Success          Lira         1.1.1.1
  4 *                            1      15 DestinationNetw… Lira         1.1.1.1
  4 *                            2       * TimedOut         Lira         1.1.1.1
  4 *                            3      16 DestinationNetw… Lira         1.1.1.1
  5 *                            1       * TimedOut         Lira         1.1.1.1
  5 *                            2      18 DestinationNetw… Lira         1.1.1.1
  5 *                            3       * TimedOut         Lira         1.1.1.1
  6 *                            1      13 DestinationNetw… Lira         1.1.1.1
  6 *                            2       * TimedOut         Lira         1.1.1.1
  6 *                            3      15 DestinationNetw… Lira         1.1.1.1
  7 *                            1       * TimedOut         Lira         1.1.1.1
  7 *                            2       * TimedOut         Lira         1.1.1.1
  7 *                            3       * TimedOut         Lira         1.1.1.1
  8 *                            1       * TimedOut         Lira         1.1.1.1
  8 *                            2       * TimedOut         Lira         1.1.1.1
  8 *                            3       * TimedOut         Lira         1.1.1.1
  9 *                            1      23 Success          Lira         1.1.1.1
  9 *                            2      23 Success          Lira         1.1.1.1
  9 *                            3      27 Success          Lira         1.1.1.1
 10 *                            1      24 Success          Lira         1.1.1.1
 10 *                            2      24 Success          Lira         1.1.1.1
 10 *                            3      22 Success          Lira         1.1.1.1

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional info

The issue is here:

public string? Hostname
{
get => _status.Destination != IPAddress.Any.ToString()
&& _status.Destination != IPAddress.IPv6Any.ToString()
? _status.Destination
: null;
}

It's perfectly possible, and valid, for Destination to be empty when not using -ResolveDestination; the fallback when Destination is an empty string should be _status.DisplayAddress.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions