Forum Home
Press F1
 
Thread ID: 97929 2009-03-04 21:25:00 Ultimate batch script to diagnose connectivity issues -- Help? Chilling_Silence (9) Press F1
Post ID Timestamp Content User
753452 2009-03-04 21:25:00 Hi all,

So Ive recently got into writing a few more batch scripts lately that constantly ping out for use during an online game -- Useful to know if somebody at home is sending 20MB emails or if its the hosts connection.

Anyways, what Im looking for now is something a little more advanced.

Im going to be leaving home in a few months when I get married, and want to leave behind a 'script' that'll help my family quickly diagnose if they're having connectivity issues and why.

Here's what I want it to do:
Run ipconfig -- If it has an IP, its connected to the WiFi. If not, the repeater or main AP may need rebooting
ping 192.168.178.3 -- This is the repeater, if it can see that, then the repeater node is working
ping 192.168.178.5 -- This is the main AP, if it can ping this, it means that all LAN filesharing etc should be fully functional at least
ping 192.168.178.99 -- This is the Printer, so even if the 'net is down they should be able to print
ping 208.67.222.222 -- (OpenDNS) This should tell them if they're connected to the 'net and there's just a problem with DNS
ping trademe.co.nz -- This should tell them that its just the site they're trying to get to thats broken

I know its possible to have all of the above just "run", but without writing some documentation that says "If it says reply from XX time=18ms" then it means its working, or if it says "request timed out" it means its failing...

It'd be nice if it just flashed up and said:
IP Configured -- You're on the Wireless
Repeater is up
Main Wireless Access Point is up
Printer is up
Internet is up
TradeMe is working

As it tries each of the tests. My problem is I have no idea how to take the information from the XP / Vista ping results and strip them down etc ...

Any ideas?

Cheers


Chill.
Chilling_Silence (9)
753453 2009-03-04 21:45:00 www.computing.net Rob99 (151)
753454 2009-03-04 22:38:00 Maybe you could throw together a quick GUI with VB? Blam (54)
753455 2009-03-05 02:21:00 Brilliant!! Thats just what Im after, I'll try tonight! :D Chilling_Silence (9)
753456 2009-03-05 02:43:00 BRILLIANT stuff!! :D


@echo OFF
echo.
echo This program will test the connectivity of your Internet
echo.
pause

cls
:test1
echo.
echo *****************************************
echo ** Testing: Wireless Repeater (Downstairs) **
echo *****************************************
ping -n 1 192.168.178.3 > NUL
if errorlevel 1 echo Wireless Repeater (192.168.178.3) Not Responding
if errorlevel 1 pause
if errorlevel 1 goto:test2
if errorlevel 0 echo Wireless Repeater (192.168.178.3) All OK
pause

:test2
echo.
echo *****************************************
echo ** Testing: Main Wireless Access Point **
echo *****************************************
ping -n 1 192.168.178.5 > NUL
if errorlevel 1 echo Main Wireless Access Point (192.168.178.5) Not Responding
if errorlevel 1 pause
if errorlevel 1 goto:test3
if errorlevel 0 echo Main Wireless Access Point (192.168.178.5) All OK
pause

:test3
echo.
echo *****************************************
echo ** Testing: Printer **
echo *****************************************
ping -n 1 192.168.178.99 > NUL
if errorlevel 1 echo Printer (192.168.178.99) Not Responding
if errorlevel 1 pause
if errorlevel 1 goto:test4
if errorlevel 0 echo Printer (192.168.178.99) All OK
pause

:test4
echo.
echo *****************************************
echo ** Testing: Online Site #1 **
echo *****************************************
ping -n 1 208.67.222.222 > NUL
if errorlevel 1 echo Online Site #1 (208.67.222.222) Not Responding
if errorlevel 1 pause
if errorlevel 1 goto:test5
if errorlevel 0 echo Online Site #1 (208.67.222.222) All OK
pause

:test5
echo.
echo *****************************************
echo ** Testing: TradeMe **
echo *****************************************
ping -n 1 TradeMe.co.nz > NUL
if errorlevel 1 echo TradeMe (TradeMe.co.nz) Not Responding
if errorlevel 1 pause
if errorlevel 1 goto:end
if errorlevel 0 echo TradeMe (TradeMe.co.nz) All OK
pause

:end
echo.
cls
echo.
echo.
echo Connectivity check complete!
echo.
pause


Easy :D

I didnt think to use the errorlevels of ping, thanks!
Chilling_Silence (9)
753457 2009-03-05 02:46:00 Just noticed the original script used:

> null
It should be:

> NUL
Chilling_Silence (9)
1