batch file

Lee HLee H Member Posts: 1,135
hi

am not too clued up on making a batch file but here's what ide like to do

we have 20+ wireless nodes in our school, they are clustered in certain areas so like English have 8 and you will get signal from the closest node, if one of them stops working then it will use the node in the next room, while this is fine it does not indicate to us that there is a problem when actually there is.

if i create a batch file that pings all of these nodes and i run it every morning that will tell me that they are all up. so is there a way of creating a batch file to ping 20 address and give results to maybe a txt file.

any help would be great

lee h
.

Comments

  • sprkymrksprkymrk Member Posts: 4,884 ■■■□□□□□□□
    What IP range do you need to ping? Are they hard coded or using DHCP? I would use the "for" command and write a batch file like this:

    FOR /L %%C IN (1,1,20) DO PING 192.168.1.%%C >> C:\TEMP\PING.TXT

    What this will do is ping computers 192.169.1.1 through 192.168.1.20 and send the standard output to a text file C:\TEMP\PING.TXT. The /L tells "FOR" to use the values in parenthesis as (start, step, end) values. The %%C is the variable represented in parenthesis. If you do this command from the cmd prompt only a single "%" symbol is needed, but in a batch file you use double "%"'s. If your ip range is different, say 172.16.10.10-25 you would change it to read like this:

    FOR /L %%C IN (10,1,25) DO PING172.16.10.%%C >> C:\TEMP\PING.TXT

    Hope that helps!
    All things are possible, only believe.
  • Danman32Danman32 Member Posts: 1,243
    By nodes, it sounds like you are talking about wireless access points. I emphasize this clarification since the wireless clients could also be considered nodes.

    Wireless connections are on the data link (layer 2) and physical layer (layer 1), not the network layer (layer 3). You can have multiple wireless access points on the same subnet, so no matter what access point your client happened to connect to, you could ping all IPs on the subnet without the assistance of routing. You would also be able to have only one DHCP server dole out the IPs to the wireless clients through all the WAPs in this case.

    Your question is kind of like asking what the phone number is of the cordless phone I happen to be using, when you only have one line coming into the house. No matter how many phones you have in the house, and no matter which phone you choose to use, you will be working with the same phonenumber.

    However, many WAPs are or can be routers as well, which would make the wireless network for that WAP be its own subnet. It would also need its own DHCP server or use a DHCP/bootp relay in order to dole out IPs to wireless clients dynamically, since DHCP requests do not usually traverse routers.

    So, to go further, it may help to understand more of the network.
  • Lee HLee H Member Posts: 1,135
    hi

    the WAP's are setup using a static IP, the signal is encrypted and thats all i know am afraid. I would like to know each day that they are all up and working, so my idea to ping them all by just using a batch file and then read results on a text seems OK. thats as simple as i can explain it, anyone need to know anymore just PM me.

    Thanks for the help

    Lee H
    .
  • sprkymrksprkymrk Member Posts: 4,884 ■■■□□□□□□□
    If the addresses are non-contigous, like say a few in the 192.168.1.x range and some are 192.168.5.x, and some are 10.0.0.x, just write that batch file like this:

    ping 192.168.1.5 >> c:\temp\ping.txt
    ping 192.168.1.6 >> c:\temp\ping.txt
    ping 192.168.1.8 >> c:\temp\ping.txt
    ping 192.168.5.5 >> c:\temp\ping.txt
    ping 192.168.5.25 >> c:\temp\ping.txt
    ping 10.0.0.2 >> c:\temp\ping.txt
    ping 10.0.0.3 >> c:\temp\ping.txt

    etc. for each ip address you want to ping. You can get a little fancier by doing this:

    echo =========== >> c:\temp\ping.txt
    echo. >> c:\temp\ping.txt
    echo %date% /T >> c:\temp\ping.txt
    echo %time% /T >> c:\temp\ping.txt
    echo. >> c:\temp\ping.txt
    ping 192.168.1.5 >> c:\temp\ping.txt
    ping 192.168.1.6 >> c:\temp\ping.txt
    ping 192.168.1.8 >> c:\temp\ping.txt
    ping 192.168.5.5 >> c:\temp\ping.txt
    ping 192.168.5.25 >> c:\temp\ping.txt
    ping 10.0.0.2 >> c:\temp\ping.txt
    ping 10.0.0.3 >> c:\temp\ping.txt
    echo. >> c:\temp\ping.txt

    This will record the date and time first. It will also give you an empty line at the beginning and end of each time the batch file is run. Substitute your own IP addresses and give it a try. Just type it all into a text file and save it as a ".bat". You could run it as a scheduled task every evening/morning too.
    All things are possible, only believe.
  • Danman32Danman32 Member Posts: 1,243
    OK, I totally misunderstood the original post. I thought you wanted the client to discover what network it was on based on the WAP it happened to pick up, yet to me it seemed that all the WAPs were on the same lan so it wouldn't matter what WAP a wireless client picked up.

    Sprkymrk has the right idea. Yuo might even be able to write a quick VB script to analyze the results of the ping and return any failures.
  • Lee HLee H Member Posts: 1,135
    thanks spymark, thats exactly what i was looking for

    cheers mate

    lee h
    .
  • woodwormwoodworm Member Posts: 153
    I know you have now received the answer, but out of interest we use a small utility called ws_watch, which is basically a graphical display that pings your devices once a minute, if no ping is returned then the device changes colour on screen. It's handy if you have an old PC/Monitor lying around as you can see at a glance that all your Servers and network equipment is up and running.

    I know there are better things than this but this is simple and free to use.

    http://cwsapps.txcyber.com/16diag.html#ws-watch

    Probably plenty of similar programs around.
  • Ricka182Ricka182 Member Posts: 3,359
    good program,....... bad link........
    i remain, he who remains to be....
  • Lee HLee H Member Posts: 1,135
    the link only works if you copy it into the address bar, it then downloads the zip file, just clicking on the link doesnt work

    lee h
    .
  • woodwormwoodworm Member Posts: 153
    icon_redface.gif Sorry, couldn't remember where I downloaded it from initially (or find the home site for the app) so I just copied the first one I found out of Google!
Sign In or Register to comment.