I am working as System admin ,every morning i comes to office i
need to ping all servers to check they are alive or not & the list of
server is huge so if i will ping to every server by typing I adress for
every server it will take more time & energy but finally i write a
batch script which ping all the servers or host on the network &
saves a log file & all this happens with a single click...
Ok let's start creating batch file.
Copy the code below
@ECHO
:LOOPSTART
time /T >> Pinglog.txt
ping 192.168.0.1 -n 4 >> Pinglog.txt
ping 192.168.0.2 -n 4 >> Pinglog.txt
ping 192.168.0.3 -n 4 >> Pinglog.txt
ping 192.168.0.4 -n 4 >> Pinglog.txt
ping 192.168.0.5 -n 4 >> Pinglog.txt
ping 192.168.0.6 -n 4 >> Pinglog.txt
pause
Now paste it into notepad & save it as autoping.bat
now the fact is in your case the ip address will change so you just
replace the ip address with your IP address in the batch file, &
you can add more ip adresses for ping there is no limit...
To Auto ping just double click the file & it will automatically
generate pinglog.txt in your batch file's directory by opening
pinglog.txt you can see the whole report....
That's It ,
Work Smarter...
Hey it was useful... But my requirement it quite different... I have more than 500 hosts which i need to ping if any one down i should be alerted through an email it is possible... If so please let me know at raja.root@gmail.com
ReplyDeleteping tester
Deleteits very working thanks
ReplyDeletesimple n easy, Cheers!
ReplyDeleteIts simpler! Shahrukh instead of individual IP's can we give the range of IP and running this batch file ?
ReplyDeleteIts pretty simpler, friend can we give a set of IP range instead of manually giving each IP ?
ReplyDeletegood start.... thank for getting me started back to writing batch commands
ReplyDeleteThanks for your post, it's helped me.
ReplyDeletehi its me again..please i need a script batch file which can ping ip address on a server and returns notification about the ip addresses which are not pingable. i need it so badly you can please send it to me through matthewchurchill50@gmail.com... thank you
ReplyDeletecan we print print ping successful or unsuccessful. .
ReplyDeleteI wondered if there was anyway to specify a name in the log file for each IP address?
ReplyDeleteafter the echo command I used
ReplyDeletedel Pinglog.txt
pause
and set N to 2 instead of 4... less junk, you can also go by pc name, not IP for all those that don't know.
Works great, thanks for the little tip.
ReplyDelete