# encoding: utf-8
# api: powershell
# title: test connectivity
# description: having problems with my dsl connection, a simple pinging log script
# version: 0.1
# author: karl prosser
# license: CC0
# x-poshcode-id: 1112
# x-archived: 2013-07-28T13:42:10
# x-published: 2009-05-18T14:28:00
#
#
$ping = new-object System.Net.NetworkInformation.Ping
$isbad = $true;
do {
try {
$Reply = $ping.send('www.yahoo.com')
if ($Reply.status –ne “Success”) { $txt = "$(get-date) problem" ; write-Host $txt ; $txt | out-File -append c:\downloads\jetstreamlog.txt}
else {
if ($isbad) {$isbad = $false;$txt = "$(get-date) RECOVERED";write-Host $txt ; $txt | out-File -append c:\downloads\jetstreamlog.txt }
$txt = "$(get-date) good" ;write-Host $txt }
}
catch {
$isbad = $true;
$txt = "$(get-date) EXCEPTION" ; write-Host $txt ; $txt | out-File -append c:\downloads\jetstreamlog.txt
}
sleep 4
}
while ($true)