Dim objEmail
Dim strMachines,aMachines,machine
Dim objPing,objStatus,objws
Dim connect,unconnect
Do
        Machine="202.96.64.68"
        Set objPing=GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" & machine & "'")
        connect=0
        unconnect=0
        For i=1 To 10
                For Each objStatus in objPing
                        If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
                                unconnect=unconnect+1
                        Else
                                connect=connect+1
                        End If
                Next
        Next
        If connect=10 Then
                MsgBox "开网啦!"      
                WScript.Quit
elseif connect=0 then MsgBox "断网啦!"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "[email protected]"
objEmail.To = "[email protected]"
objEmail.Subject = "网通DNS问题"
objEmail.Textbody = "网通DNS问题."
objEmail.Send  
WScript.Quit
End If
WScript.Sleep 3*1000      
Loop
do
set ws=createobject("wscript.shell")
ws.run"B.vbs"
wscript.sleep 5000
loop