Test connection to site on port 80 and 443 with PowerShell, if port 443 fails, then do trace route
Test a connection to a site on port 80 and 443 every 15 seconds for 99999 times. If connection to port 443 fails the run a trace route to find the problem. A log is written to the desktop (currently logged on user's desktop) which prints date and time for very check made.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$username = [Environment]::UserName | |
while($i -lt 99999) | |
{ | |
echo "Test #$i" | Out-File C:\users\$username\Desktop\log.txt -Append | |
date | Out-File C:\users\$username\Desktop\log.txt -Append | |
Test-NetConnection -ComputerName "www.YourDomainHere.dk" -Port 80 -InformationLevel "Detailed" | Out-File C:\users\$username\Desktop\log.txt -Append | |
$netTest = Test-NetConnection -ComputerName "www.YourDomainHere.dk" -Port 443 -InformationLevel "Detailed" | Tee-Object -FilePath C:\users\$username\Desktop\log.txt -Append | |
if($netTest.TcpTestSucceeded -ne "True") | |
{ | |
tracert www.YourDomainHere.dk | Out-File C:\users\$username\Desktop\log.txt -Append | |
} | |
echo *** | Out-File C:\users\$username\Desktop\log.txt -Append | |
Start-Sleep -s 15 | |
$i++ | |
} |
Kommentarer
Send en kommentar