[ Home ] [ Tech Tips ] [ Raspberry Pi ] [ Powershell ] [ Ubuntu ] [ Django ] [ About ]
Powershell | Ping log

 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. Any questions, comments or suggestions email me [email protected]
Luke Keam
techgeek.biz

FOLLOW US

Name
Email:

AD