PowerTip: Use PowerShell to Count Hops to Server

PowerTip: Use PowerShell to Count Hops to Server

  • Comments 3
  • Likes

Summary: Use Windows PowerShell to count hops to a server.

Hey, Scripting Guy! Question On my computer running running Windows 8.1, how can I use Windows PowerShell to verify
          the number of hops to my server?

Hey, Scripting Guy! Answer Use the Test-NetConnection function and the –TraceRoute parameter,
          specify the server name, choose the TracerOut property, and get the count:

(Test-NetConnection -TraceRoute -ComputerName "www.contoso.com").traceroute.count 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Why does this only work on Windows 8.1 and Server 2012 R2? Couldn't they make this work on Windows 7 and Server 2008 R2? Or is this something built into the Network stack?

  • An alternate that can work somewhat in versions before Windows 8 and Server 2012 is this line in Windows PowerShell...

    (Tracert www.contoso.com).count-6

    Sean