Check Internet connectivity automatically via script and reconnect

wolfsta

New member
Local time
4:27 PM
Messages
2
Hi all

I have a few computers that connect via rasdial to a bridged modem. They are dropping off randomly and frequently enough that its a pain to have to reset them manually everytime.

Does anyone know how I could write a script or something that would check for internet connectivity and if there is none then it would re dial the pppoe connection?

Thanks

Wolfsta
 

My Computer My Computer

OS
OS X 10.8
If anyone is curious. This is how I solved the issue.

Friend of mine wrote a basic Powershell script:

$site = "Kelly-PC"
$wait = 60
$nl = [Environment]::NewLine

While ($TRUE)
{
if(!(Test-Connection -computer $site -count 1 -quiet))
{
Write-Host -ForegroundColor Red -NoNewline "Connection Down...$nl"
rasdial attdsl [email protected] password
}
else
{
Write-Host -ForegroundColor Green -NoNewline "Connection Up...$nl"
Start-Sleep -Seconds $wait
}
}

$site is the name of the computer
$wait is the time in seconds before next test
and the "rasdial attdsl [email protected] password" line dials my pppoe connection called attdsl with the specified user and password when no connection is available.
 

My Computer My Computer

OS
OS X 10.8
Back
Top