Veröffentlicht 17. Februar 200916 j Hallo Zusammen! Ich habe leider folgendes Problem: Wie kann ich mit Hilfe einer Batch von meinem PC aus den DNS-Suffix eines Servers auslesen? Hintergrund: Habe eine Liste mit 400 Servern, bei denen Überprüft werden soll, ob Sie den richtigen DNS-Suffix besitzen. Hoffe irgendwer hat eine Idee. Danke schonmal im vorraus. Viele Greetz
20. Februar 200916 j Habs doch geschafft eine Lösung für zu finden. =) Falls es irgendwer mal gebrauchen kann: - Rechner aus Liste (Serverliste.txt) anpingen - DNS-Suffix von Rechnern aus Liste (Serverliste.txt) auslesen ( in dem Beispiel können 2 DNS Suffix angegeben werden) @echo off set /a cnt1=0 set /a cnt2=0 set /a cnt3=0 for /f "tokens=1" %%i in (serverlist.txt) do call :loop1 %%i call :Gesammt call:end :loop1 ping %1>NUL echo Server: %1 echo Errorcode: %errorlevel% if %errorlevel% == 0 call :an %1 if not %errorlevel% == 0 call :aus %1 goto:eof :an call :nslookup %1 call :nslookup2 %1 set /a cnt1+=1 echo %1 Ping OK %DNS1% %DNS2%>> Ergebnis.txt goto:eof :aus call :nslookup %1 call :nslookup2 %1 set /a cnt2+=1 echo %1 Ping error %DNS1% %DNS2%>> Ergebnis.txt goto:eof :nslookup nslookup %1.*DNS-Suffix1* >> Temp.txt for /f "delims= skip=1" %%j in ('findstr "*DNS-Suffix1*" Temp.txt') do ( call :dir del Temp.txt goto:eof ) call :no_dir del Temp.txt goto:eof :nslookup2 nslookup %1.*DNS-Suffix2* >> Temp2.txt for /f "delims=" %%j in ('findstr "*DNS-Suffix2*" Temp2.txt') do ( call :dir2 del Temp2.txt goto:eof ) call :no_dir2 del Temp2.txt goto:eof :dir set DNS1=*DNS-Suffix1* goto:eof :no_dir set DNS1=no *DNS-Suffix1* goto:eof :dir2 set DNS2=*DNS-Suffix2* goto:eof :no_dir2 set DNS2=no *DNS-Suffix2* goto:eof :Gesammt set /a cnt3=cnt1+cnt2 echo on: %cnt1% echo off: %cnt2% echo Total: %cnt3% echo on: %cnt1% >> Statistik.txt echo off: %cnt2% >> Statistik.txt echo Total: %cnt3% >> Statistik.txt goto:eof :end pause exit
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.