Test-NetConnection

In the absence of Nmap on a Windows PC, Test-NetConnection can serve as an alternative

Usage:

Test-NetConnection [-ComputerName] <String> [-Port <Int32>] [-InformationLevel <InformationLevel>]

Key Parameters:

  • -ComputerName: Specifies the target host or IP address to test connectivity.

  • -Port: Specifies the target port number to test. If not provided, a default port is used.

  • -InformationLevel: Specifies the level of detail in the output.

Common Scenarios:

  1. Basic Connectivity Test:

    Test-NetConnection -ComputerName example.com

    Performs a basic connectivity test to the specified host.

  2. Port Test:

    Test-NetConnection -ComputerName example.com -Port 80

    Tests connectivity to a specific port on the target host.

  3. Detailed Output:

    Test-NetConnection -ComputerName example.com -Port 443 -InformationLevel Detailed

    Provides detailed information about the connection, including source and destination IP addresses.

Examples:

  • Basic connectivity test to example.com:

    Test-NetConnection -ComputerName example.com
  • Test connectivity to port 80 on example.com:

    Test-NetConnection -ComputerName example.com -Port 80
  • Detailed output for port 443 on example.com:

    Test-NetConnection -ComputerName example.com -Port 443 -InformationLevel Detailed

Resources:

Last updated