PowerShell: Download and run Sysinternals PSPing to test network connectivity over TCP
# Define the URL and the output file path for PsPing
$pspingURL = "https://live.sysinternals.com/PsPing.exe"
$pspingFilePath = "C:\Temp\PsPing.exe"
# Create the output directory if it doesn't exist
If (!(Test-Path -Path (Split-Path -Path $pspingFilePath))) {
New-Item -ItemType Directory -Path (Split-Path -Path $pspingFilePath) -Force
}
# Download PsPing
Invoke-WebRequest -Uri $pspingURL -OutFile $pspingFilePath
# Test the connection using PsPing with the -accepteula flag
& $pspingFilePath -accepteula "8.8.8.8:443"