Alliance Broadband Autologin Windows Script

ozone007

Member
[OP]
Mar 29, 2017
34
8
Those who suffer from frequently disconnecting while away and downloading something it might be helpful

This is windows shell script . save this as .vbs file and you can either integrate it to startup or you can manually run it . Dont forget to put ur userid and password in respective field called your_id and your_password

Code:
set WshShell = CreateObject("WScript.Shell")
Dim Counter : Counter = 1

  While Counter > 0
  
    If Ping("www.google.com")  Then
          WScript.Sleep (1000*60*5)  'every 5 min check
  
        Else
      logstat()
  
    End If
  
Wend

WScript.Quit 1

Sub login()
    Set IE = CreateObject("InternetExplorer.Application")  
     IE.Visible = 1  
     IE.navigate "http://10.254.254.46/0/up/"  
   Do While (IE.Busy)  
         WScript.Sleep 100  
   Loop
    On Error Resume Next
     Set Helem = IE.document.getElementByID("username")  
     Helem.Value = "your_username"                                                         ' change this to yours      
     Set Helem = IE.document.getElementByID("password")  
     Helem.Value = "your_password"                                                          ' change this to yours  
     IE.Document.getElementsByName("login").Item(0).Click
    If Err.Number <> 0 Then
    Err.Clear
    End If
    closeie()
End Sub

Sub closeie()
  
  
    Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate, (Debug)}!\\.\root\cimv2")
    Set cProcessList = oWMIService.ExecQuery("Select * from Win32_Process Where Name = 'iexplore.exe'")

    For Each oProcess In cProcessList
        oProcess.Terminate()
    Next
  
End Sub




Function Ping(strHost)

    dim objPing, objRetStatus

    set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
      ("select * from Win32_PingStatus where address = '" & strHost & "'")

    for each objRetStatus in objPing
        if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
        Ping = False
            'WScript.Echo "Status code is " & objRetStatus.StatusCode
        else
            Ping = True
            'Wscript.Echo "Bytes = " & vbTab & objRetStatus.BufferSize
            'Wscript.Echo "Time (ms) = " & vbTab & objRetStatus.ResponseTime
            'Wscript.Echo "TTL (s) = " & vbTab & objRetStatus.ResponseTimeToLive
        end if
    next
End Function

Function logstat()
  
      
    
    If Ping("10.254.254.46")And Not Ping("www.google.com") Then
        login()
    Else
    End If
End Function
 
Last edited:
  • Like
Reactions: Sushubh