Archer C9 Reboot Script

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.

Archer C9 Reboot Script

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
Archer C9 Reboot Script
Archer C9 Reboot Script
2019-08-25 19:08:01 - last edited 2019-08-26 19:24:03
Model: Archer C9  
Hardware Version: V5
Firmware Version:

Hi,

 

I wanted a script which Reboots the Archer C9 but actually i didnt find anything,

 

The VBS script will run and if google is not up for 2 mins, then it Reboots the Router. It is cool when you are not at home and you have RDC.

 

Before you blame on me its not pretty or has a best practice, pls come up with a better one.

 

 

Run VBS on start of Windows.

 

 

CODE:

===================

 

 

 

 

'Reboot TP-Link Archer C9 v5
Const P = "Your password"            'Your password
Const MaxMissing = 12                'For 2 mins there is no google
Const CheckIntervalSec = 300000        '5 minutes
Set WshShell = CreateObject("WScript.Shell")

'Infinite loop - kill wscript.exe if you want to stop this
Do
    MissingCounter = 0
    'Keep monitoring
    Do While MissingCounter <= MaxMissing
        SuccessfulPing = Not CBool(WshShell.Run("ping -n 1 googlqqqe.com",0,True))
        If SuccessfulPing Then
            MissingCounter = 0
            Call WScript.Sleep(CheckIntervalSec)
        Else
            MissingCounter = MissingCounter + 1
            WScript.Sleep(10000)    'Wait 10s
        End If
    Loop
    
    On Error Resume Next
    If Not objIEBrowser Is Nothing Then objIEBrowser.Quit
    Set objIEBrowser = CreateObject("InternetExplorer.Application")
    objIEBrowser.Visible = True
    objIEBrowser.Top = 0
    objIEBrowser.Left = 0
    objIEBrowser.Width = 1920
    objIEBrowser.Height = 1080
    CreateObject("WScript.Shell").AppActivate "Internet Explorer"
    Call WScript.Sleep(2000)

    objIEBrowser.Navigate "https://192.168.0.1/webpages/login.html"
    Do While objIEBrowser.Busy: Loop

    Set HTMLDoc = objIEBrowser.Document
    HTMLDoc.getElementById("overridelink").Click
    Do While objIEBrowser.Busy: Loop

    Set HTMLDoc = objIEBrowser.Document
    objIEBrowser.Visible = True
    Call WScript.Sleep(3000)
    WshShell.SendKeys "{TAB 6}"
    Call WScript.Sleep(2000)
    WshShell.SendKeys P
    Call WScript.Sleep(1000)
    WshShell.SendKeys "{TAB 2}"
    Call WScript.Sleep(1000)
    HTMLDoc.getElementById("login-btn").Click
    Do While objIEBrowser.Busy: Loop

    Call WScript.Sleep(3000)
    HTMLDoc.getElementById("txt-reboot").Click
    Call WScript.Sleep(3000)
    HTMLDoc.getElementsByClassName("button-button btn-msg btn-msg-ok btn-confirm")(0).Click
    Call WScript.Sleep(120000)
    objIEBrowser.Quit
Loop

  0      
  0      
#1
Options

Information

Helpful: 0

Views: 1430

Replies: 0

Related Articles