Friday 22 June 2012

How to ping Multiple pc's using batch file & generate log file



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...

0 comments:

Post a Comment