»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

View Poll Results: Do you think this script is useful?
Yes- It is useful to me just like it is 1 50.00%
Yes- But it needs more functionality. 0 0%
No- But with some work it could be 1 50.00%
No- Why on Earth did you do this? 0 0%
Voters: 2. You may not vote on this poll

Reply
 
LinkBack Thread Tools Display Modes
Old 07-26-2003, 11:13 PM   #1 (permalink)
Banned
 
Siliconjunkie's Avatar
 
Join Date: Feb 2003
Location: Houston, TX
Posts: 1,595
Siliconjunkie is on a distinguished road
Send a message via AIM to Siliconjunkie
A handy batch file to check network connectivity.

I wrote this today to provide an easy way for anyone to see if a computer is on the network/internet and even do some basic troubleshooting.

It assumes that you are on a LAN, with a router at 192.168.1.1 If someone wanted to take the time they could probably extract the info from an ipconfig to make it more portable, but like it is, it will work for a lot of folks. Just cut and past into a text file and save with a .bat extension and you should be good to go. Could easily be put on a floppy or e-mailed to someone to test with.

Here is the basic rundown on what it does[list=1][*]Trys to ping www.google.com with 1 packet, if it succeeds it ends with a success message.[*]If it fails, it will try 3 more packets, if that succeeds, it will finish but warn it detected packet loss.[*]If it still fails, it will try by IP address to test DNS, if this succeeds it will tell you that it had DNS issues.[*]If it still fails it will try to ping 192.168.1.1 and if it succeeds will tell you it can reach the router but not internet.[*]If the ping to 192.168.1.1 fails, it will tell you the network is down.[/list=1]

Code:
@echo off
ECHO Checking connection, please wait...
PING -n 1 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS
IF     ERRORLEVEL 1 goto :TRYAGAIN

:TRYAGAIN
ECHO FAILURE!
ECHO Let me try a bit more, please wait...
@echo off
PING -n 3 www.google.com|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESS2
IF     ERRORLEVEL 1 goto :TRYIP

:TRYIP
ECHO FAILURE!
ECHO Checking DNS...
ECHO Lets try by IP address...
@echo off
ping -n 1 216.239.37.99|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :SUCCESSDNS
IF     ERRORLEVEL 1 goto :TRYROUTER

:TRYROUTER
ECHO FAILURE!
ECHO Lets try pinging the router....
ping -n 2 192.168.1.1|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :ROUTERSUCCESS
IF     ERRORLEVEL 1 goto :NETDOWN

:ROUTERSUCCESS
ECHO It appears that you can reach the router, but internet is unreachable.
goto :FAILURE

:NETDOWN
ECHO FAILURE!
ECHO It appears that you having network issues, the router cannot be reached.
goto :FAILURE

:SUCCESSDNS
ECHO It appears that you are having DNS issues.
goto :FAILURE

:SUCCESS
ECHO You have an active Internet connection
pause
goto END

:SUCCESS2
ECHO You have an active internet connection but some packet loss was detected.
pause
goto :END

:FAILURE
ECHO You do not have an active Internet connection
pause
goto :END

:END

Siliconjunkie is offline   Reply With Quote
Old 07-26-2003, 11:41 PM   #2 (permalink)
Registered User
 
RedFury's Avatar
 
Join Date: Jun 2002
Location: mInN3$0t@
Posts: 1,303
RedFury is on a distinguished road
Send a message via AIM to RedFury
Fun! I suppose I could modify some of that to suit my own needs/wants/desires....

Quote:
:FAILURE
ECHO You do not have an active Internet connection
pause
goto :END
:FAILURE
ECHO Hey Moron, it still doesn't work. quit tryin' !
pause
goto :END
__________________
do it right, do it yourself. If that doesn't work, prepare to pay for your mistakes.
RedFury is offline   Reply With Quote
Old 07-26-2003, 11:44 PM   #3 (permalink)
Banned
 
Siliconjunkie's Avatar
 
Join Date: Feb 2003
Location: Houston, TX
Posts: 1,595
Siliconjunkie is on a distinguished road
Send a message via AIM to Siliconjunkie
You could also change the responses/actions based on username if you used %username% string.
Siliconjunkie is offline   Reply With Quote
Old 07-27-2003, 07:23 AM   #4 (permalink)
Registered User
 
meese's Avatar
 
Join Date: Jun 2003
Location: NJ
Posts: 1,096
meese is on a distinguished road
Silicon,

Nice little proggy! Thanks.
meese is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 05:56 AM.