I need to scan several systems in the network within IP range 172.18.x.x to 172.25.x.x and check whether each of them is active or not, and then dump the result in a file. Following is the script:
@echo off for /L %%x in (18,1,25) do ( for /L %%y in (1,1,254) do ( for /L %%z in (1,1,254) do ( ping -n 1 172.%%x.%%y.%%z | find "Reply" > NUL IF NOT ERRORLEVEL 1 (set state=UP) ELSE (set state=DOWN) echo 172.%%x.%%y.%%z is %state% >> state.txt )))
But, the result concludes that every system is 'UP' even though some IP addresses are unused.
Any problem with the script?