Checking network connectivity

One of the first things you can do in terms of troubleshooting is to determine whether you have network connectivity between your hosts.

Getting ready

This recipe uses servers in the Reskit.Org domain (DC1, DC2, SRV1, and SRV2)that you have previously installed. Run this recipe on SRV1.

How to do it...

  1. Use Test-Connection to test the connection to DC1:
    Test-Connection -ComputerName DC1
  2. Redo the test with a simple true/false return:
    Test-Connection -ComputerName DC1 -Quiet
  3. Test multiple systems at once:
    Test-Connection -ComputerName 'DC1','DC2','SRV2' -Count 1
  4. Test the connectivity for SMB traffic with DC1:
    Test-NetConnection -ComputerName DC1 -CommonTCPPort SMB 
  5. Get a detailed connectivity check by using DC1 with HTTP:
    $TNCHT ...

Get Windows Server 2019 Automation with PowerShell Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.