The Test-Connection
cmdlet in PowerShell is used to test network connectivity by sending ICMP echo request packets, commonly known as “ping” requests, to a specified remote computer or destination.
Here’s how to use Test-Connection
:
- Open PowerShell by searching for it in the Start menu or by pressing Win + X and selecting “Windows PowerShell” or “Windows PowerShell (Admin)”.
- Once PowerShell is open, you can use the
Test-Connection
cmdlet followed by the target computer name or IP address. For example:
- To test connectivity to a remote computer by name:
Test-Connection -ComputerName RemoteComputerName
- To test connectivity to a remote computer by IP address:
Test-Connection -ComputerName 192.168.1.1
- You can also specify parameters such as
-Count
to specify the number of echo requests to send and-Quiet
to suppress the output and return a Boolean value indicating success or failure.
- After executing the
Test-Connection
cmdlet with the desired parameters, PowerShell will send ICMP echo requests to the specified target and display the results.
Source for More Information
Here’s a source where you can find more detailed information about Test-Connection
and other PowerShell cmdlets:
- Microsoft Docs: Test-Connection cmdlet
The Microsoft Docs page provides comprehensive documentation on PowerShell cmdlets, including Test-Connection
, with detailed explanations, examples, and usage scenarios.