|I am an admin. We can't use unauthorized software whether or not it requires installation.|
I have a list of 50 machines on the network that I have computer names for. I don't know if they are on or not. I don't know the IP addresses either(which doesn't really matter). I need to ping the machines and see if they are available before I remotely connect to them to patch them. I want the script to make a csv file that will have the computername,IP address,ping status. If it isn't reachable, then I need to call someone there to turn the machine on. Right now, we ping each machine independently.
Here's what I am using now, but it for some reason keeps listing the same IP address.
Echo Computername,IP Address,State>Final5.csv
for /f "usebackq tokens=*" %%A in ("%ComputerList%") do (
for /f "tokens=3" %%B in ('ping -n 1 -l 1 %%A ^|findstr Reply') do (
for /f %%A in (%ComputerList%) do call :Sub %%A
ping %1 -n 1 > NUL
if ERRORLEVEL 1 set state=No Reply