dsquery * domainroot -filter "(objectcategory=computer)" -limit 0 | dsget computer -dn -disabled | find /i "no" > all_comp.txt
filtrera bort allt utom datornamnet och spar i en fil med namnet "computers.txt"
kör sedan detta script:
@echo off
set ComputerList=computers.txt
Echo Computername,IP Address>Final.csv
setlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%A in ("%ComputerList%") do (
for /f "tokens=3" %%B in ('ping -n 1 -l 1 %%A ^|findstr Reply') do (
set IPadd=%%B
echo %%A,!IPadd:~0,-1!>>final.csv
)
)