powershell ping log

Simple one with this quick script in powershell will ping a desired host and have an output and the close when you decide to stop it, easy peasey

Have a great day

# PingLog.ps1

$outputpath = "~\ping_output.txt"

$pingaddress = "google.com"

$seconds = 60

$yes = 'True'
# start loop

while ($yes = 'True') {

$test = Test-Connection -ComputerName $pingaddress -Count 1 -Quiet

$date = Get-Date

Write-Host "$date, $test"

"$date, $test" | Out-File -FilePath $outputpath -Append

Start-Sleep -Seconds $seconds

}

Luke Keam
Thank you for reading. Email me: [email protected]
Luke Keam | techgeek.biz