I used dsquery to generate a file that contains the names of all computers in the domain. Now i want to create a report that will contain only computers that respond to a ping.
Workstations.txt is a file with all my computers names in it. This command does generate a new file with only the alive machines.
for /f %%a in (workstations.txt) do ping -a -n 1 %%a | find "TTL" >> HostsUp.txt
Here is a sample from the Hostsup.txt file:
Reply from 192.168.1.132: bytes=32 time<1ms TTL=128
Reply from 192.168.1.131: bytes=32 time<1ms TTL=128
Reply from 192.168.1.112: bytes=32 time<1ms TTL=128
Reply from 192.168.1.134: bytes=32 time<1ms TTL=128
What i really want is the HostsUp.txt file to have only the name (or ip) only and get rid of the rest of the info.
I want it to look this way: (it could be the machine name - doesn't matter either way works)
Any help is very appreciated !!!