Hello,
I would like to make a script which pings all pc's in my network (192.168.1.3 to 192.168.1.15) with a ping count of 1 and a timeout of 100 ms. If all PC's are offline the router need to be rebooted. If one PC is online, the computer doesn't need to do anything.
So this is what I have so far:
However, it does not seem to work. In both scenario's I get a message that it's online AND offline.
I would like to make a script which pings all pc's in my network (192.168.1.3 to 192.168.1.15) with a ping count of 1 and a timeout of 100 ms. If all PC's are offline the router need to be rebooted. If one PC is online, the computer doesn't need to do anything.
So this is what I have so far:
Code:
@echo off
del /Q badhost.log
for /f %%I in (machines.txt) do (
ping -n 1 -w 100 %%I | find "Reply" > nul
if not errorlevel 1 echo %%I reachable >> badhost.log )
echo off
if NOT EXIST badhost.log goto reboot
:reboot
iexplore http://192.168.1.1/apply.cgi?action_mode=Save%26Restart+¤t_page=SaveRestart.asp&wl_wep_x=0&wl_key1=&wl_key2=&wl_key3=&wl_key4=&next_page=Basic_SaveRestart.asp&sid_list=General%3B&group_id=&modified=0&act
However, it does not seem to work. In both scenario's I get a message that it's online AND offline.