Check Internet connectivity automatically via script and reconnect


  1. Posts : 2
    OS X 10.8
       #1

    Check Internet connectivity automatically via script and reconnect


    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


  2. Posts : 2
    OS X 10.8
    Thread Starter
       #2

    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 user@att.net 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 user@att.net password" line dials my pppoe connection called attdsl with the specified user and password when no connection is available.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 23:18.
Find Us