2

#PSTip A hidden gem of the Test-Connection cmdlet

PowerShell equivalent of the ping.exe utility is the Test-Connection cmdlet. One of the hidden and less known capabilities of Test-Connection is the abitlity to ping a computer using another computer as the source. For example, when troubleshooting, you often need to verify connectivity between two computers using a quick ping test. The common practice is to make a remote desktop connection to ComputerA, open cmd, then ping ComputerB.

With the Test-Connection cmdlet you are no longer required to do so. You can use the cmdlet to initiate a ping check that uses ComputerA as the source computer and ComputerB as the destination.

PS> Test-Connection -Source ComputerA -ComputerName ComputerB

Note: WMI is the underlying mechanism that Test-Connection is built upon and this method requires the caller to have administrator’s rights on the source computer and the source computer’s OS version must be Windows XP and above.

Filed in: Columns, Tips and Tricks Tags: , , , ,

2 Responses to "#PSTip A hidden gem of the Test-Connection cmdlet"

  1. FranktheFink says:

    I have used the CMDlet daily for AGES and never noticed this- thanks Shay!

Leave a Reply

Submit Comment

© 2016 PowerShell Magazine. All rights reserved. XHTML / CSS Valid.
Proudly designed by Theme Junkie.
%d bloggers like this: