Hey Guys
i am really new Bi for Macros
and i really will appreciate if some one can help me to solve my problem.
I use to surf my personal PC from my office Pc by logme in & Team Viwer for downloading files from free server
my problem is sometime my wifi driver use to crash so i need to restart my pc and some times my modem use to hangup so i need to restart it
i can setup script that can restart both one by one every hour or two hour
but i want a script/macro that can check for my internet connect like by ping to my modem or some site and if internet connection is not working it can trigger to to some exe file so it can restart my pc and reboot modem after restart.
so in short i am looking for help to develop macro that can check for internet connection like every 15 min and trigger pc & modem reboot if internet is disconnected.
pls guys help me out
thanks in advance
Help for checking internet connection and restarting modem
Moderators: JRL, Dorian (MJT support)
Help for checking internet connection and restarting modem
In God I Trust For Rest I Do Virus Scan
This script can ping a domain name or host IP.
Pinging a domain
Pinging a host IP
Pinging a domain
Code: Select all
VBSTART
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
'MsgBox "Status code is " & objRetStatus.StatusCode
else
Ping = True
'MsgBox "Bytes = " & vbTab & objRetStatus.BufferSize & vbCRLF & _
' "Time (ms) = " & vbTab & objRetStatus.ResponseTime & vbCRLF & _
' "TTL (s) = " & vbTab & objRetStatus.ResponseTimeToLive
end if
next
End Function
VBEND
Label>PingLoop
//Wait 1 second
wait>1
//Change to any website. I'm using google.com in this example
VBEval>Ping("google.com"),pinged
If>pinged=True
MessageModal>host contacted
Else
MessageModal>host not contacted
//Restart Modem/PC
Endif
Goto>PingLoop
Pinging a host IP
Code: Select all
VBSTART
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
'MsgBox "Status code is " & objRetStatus.StatusCode
else
Ping = True
'MsgBox "Bytes = " & vbTab & objRetStatus.BufferSize & vbCRLF & _
' "Time (ms) = " & vbTab & objRetStatus.ResponseTime & vbCRLF & _
' "TTL (s) = " & vbTab & objRetStatus.ResponseTimeToLive
end if
next
End Function
VBEND
Label>PingLoop
//Wait 1 second
wait>1
//Change to any host IP you like. I'm using Google's IP in this example.
VBEval>Ping("72.14.209.104"),pinged
If>pinged=True
MessageModal>host contacted
Else
MessageModal>host not contacted
//Restart Modem/PC
Endif
Goto>PingLoop