Das hängt davon ab, wie groß / flexibel Ihr Sortiment sein muss.
In der einfachsten Form
baseIP="10.10." for a=0 to 255 for b=0 to 255 IP=baseIP&a&"."&b <\Your code here> next b next a
Später mehr
Etwas, das einer Subnetzsuche ähnelt
main sub main Dim WshShell, oExec Dim x Set wshShell = CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objInputFile = objFSO.OpenTextFile("c:\scripts\computers.txt",1) Do until objInputFile.AtEndofStream userIP = objInputFile.ReadLine numBits=Mid(userIP,instr(1,userIP,"/")+1,3) numIP=CDbl(2^(32-mid(userIP,instr(1,userIP,"/")+1,3))) ip=Mid(userIP,1,instr(1,userIP,"/")-1) a=Split(ip,".") 'Darn vbscript has signed numbers so -2 billion to pos 2 billion ' and ip's go 0 to 4 billion 'lame work around If a(0)>127 Then offset=128 Else offset=0 a(0)=a(0)-offset ipnum=CDbl((a(0)*256^3)+(a(1)*256^2)+(a(2)*256)+a(3)) ipEnd=CDbl(ipnum+numIP) For x=ipnum To ipEnd grab=Hex(x) grab2=Mid("00000000"&grab,Len(grab)+1,8) a=CLng("&h"&Mid(grab2,1,2))+offset b=CLng("&h"&Mid(grab2,3,2)) c=CLng("&h"&Mid(grab2,5,2)) d=CLng("&h"&Mid(grab2,7,2)) newip=a&"."&b&"."&c&"."&d WScript.echo "newip:"&newip inventory(newip) Next Loop end sub
IP-Adressen starten und beenden
begIP="10.10.3.1" endIP="10.10.10.1" a=Split(begIP,".") b=Split(endIP,".") 'Darn vbscript has signed numbers so -2 billion to pos 2 billion ' and ip's go 0 to 4 billion 'lame work around If a(0)>127 Then offset=128 Else offset=0 a(0)=a(0)-offset b(0)=b(0)-offset ipnum=CDbl((a(0)*256^3)+(a(1)*256^2)+(a(2)*256)+a(3)) ipEnd=CDbl((b(0)*256^3)+(b(1)*256^2)+(b(2)*256)+b(3)) For x=ipnum To ipEnd grab=Hex(x) grab2=Mid("00000000"&grab,Len(grab)+1,8) a=CLng("&h"&Mid(grab2,1,2))+offset b=CLng("&h"&Mid(grab2,3,2)) c=CLng("&h"&Mid(grab2,5,2)) d=CLng("&h"&Mid(grab2,7,2)) newip=a&"."&b&"."&c&"."&d WScript.echo "newip:"&newip inventory(newip) Next end sub