本帖最后由 yu2n 于 2015-1-4 18:10 编辑
PPPOE 批量账号挂机1小时 by Yu2n
适用于 Win7x64, XPSP3x86 ,没有经过功能测试。
自行替换『自定义登陆账号』部分的账号与密码。
PPPOE 批量账号挂机1小时.vbs- ' 建立宽带连接
- Call PPPOE_Init()
-
- ' 自定义登陆账号
- Call OnLine("账号1", "密码1")
- Call OnLine("账号2", "密码2")
- Call OnLine("账号3", "密码3")
- Call OnLine("账号4", "密码4")
- Call OnLine("账号5", "密码5")
- Call OnLine("账号6", "密码6")
-
- ' 指定账号挂PPPOE在线1小时1分钟
- Sub OnLine(ByVal strUserName, ByVal strPassWord)
- Dim wso
- Set wso = CreateObject("WScript.Shell")
-
- ' 连接宽带
- wso.Run "rasdial ""宽带连接"" """ & strUserName & """ """ & strPassWord & """", 1, False
-
- ' 挂机 1 小时 1 分钟
- WScript.Sleep (1 * 60 * 60 + 1 * 60 ) * 1000
-
- ' 断开连接宽带
- wso.Run "rasdial ""宽带连接"" /DISCONNECT", 1, False
-
- End Sub
-
- ' 建立宽带连接
- Sub PPPOE_Init()
- ' 创建宽带连接(XP/Win7)
- Set wso = CreateObject("WScript.Shell")
- wso.Run "taskkill /f /im rasphone.exe", 0, True
- wso.Run "rasphone -r ""宽带连接""", 1, True
- wso.Run "rasphone -a ""宽带连接""", 1, False
- WScript.sleep 300
- If GetSystemVersion() < 60 Then
- 'WinXP
- wso.SendKeys "(%R)"
- WScript.Sleep 300
- wso.SendKeys "(%N)"
- WScript.Sleep 300
- wso.SendKeys "{ENTER}"
- Else
- 'Win7
- wso.SendKeys "(%B)"
- WScript.Sleep 300
- wso.SendKeys "(%C)"
- End If
-
- ' 创建宽带连接桌面快捷方式
- strLnkPth = wso.SpecialFolders("Desktop")
- Set objLink = wso.CreateShortcut(strLnkPth & "\宽带连接.lnk")
- objLink.TargetPath = "%windir%\system32\rasphone.exe"
- objLink.Arguments = "-d 宽带连接"
- 'objLink.WindowStyle = 1 ' 1=常规,3=最大化,7=最小化
- 'oShellLink.Hotkey = "" ' 设置快捷方式的快捷键
- objLink.IconLocation = "SHELL32.dll,17"
- objLink.Description = "连接 宽带连接"
- objLink.WorkingDirectory = "%windir%\system32"
- objLink.Save
-
- '打开控制面板
- wso.Run "Control netconnections", 1, False
- End Sub
-
- '取得操作系统版本
- Function GetSystemVersion()
- For Each objItem In GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")
- GetSystemVersion = CInt(Split(objItem.Version, ".")(0) & Split(objItem.Version, ".")(1))
- Next
- End Function
复制代码
|