#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.Share on: