techgeek.biz being a geek is fun

[ Home ] [ Tech Tips ] [ Getting Started ] [ Contact ] [ About ]  
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 = "C:\Users\lukek\Desktop\output.txt"

$pingaddress = "google.com"

$seconds = 60

$yes = 'True'

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

Luke Keam

Thank you for reading.

Any questions, comments or suggestions
Email [email protected]

Have a great day from

Luke Keam 
techgeek.biz 
 

AD


                   

        

FOLLOW US

youtubemail

AD