Using Powershell to test connectivity

Usually, I use Python for scripting, but this time I had to choose PowerShell for some reason. It is the first time I have used PowerShell, but I must confess it is pretty easy to use.
I’ve started with a small test script, and I have ended up writing a couple more.
These are some scripts that can be used to test access to URLs, file shares, RDP access, and SSH access.
These can be useful when you need to test access from a new/remote office, remote VPN user, home office, etc. Besides the tests that it is doing it will show you the local DNS servers, and if you use a VPN, it should also show you the DNS servers of the VPN connection.

  • conn_test.ps1 – is a script for testing access to the Internet. It pings different DNS servers, and it shows you your public IP and the default local DNS servers.

  • dns_testing.ps1 – is a script that checks the domain names from a list of URLs. It also checks that the DNS name resolves.

  • vpn_testing_ps1 – is a script that tests access to URLs, file shares, RDP access, and SSH access. It also checks that the DNS name resolves.

  • conn_tool.ps1 – This is an interactive tool to test a specific protocol (RDP, SSH,file-share) to a specific host provided by the user in the CLI. It can also do multiple tests, like: ssh, port,rdp

  • process_csv.ps1 – This script takes a CSV file with routing info, exported from a device, and processes it (subnet and remote device name), and then exports to another destination CSV file (subnet and remote location)
  • iplookup.ps1 – This script takes an IP as an argument(CLI) and determines which site this IP is from. It needs a destination CSV file processed by process_csv.ps1

You can find the scripts here:
https://github.com/czirakim/Powershell.Test.stuff/tree/main

About the author

Mihai is a Senior Network Engineer with more than 15 years of experience