I have a script that pings a range of adresses and then puts them in a file (ip , hostname)
now i would like the script to add the serial number , the username and which service pack it runs .
The user profiles have no admin rights
can some give me a direction
this is what i have so far
TempFilename = "c:\IPtemp.txt"
outputfile = "c:\output.txt"
startip = "193.53.107.2"
endip = "193.53.107.10"
notfound = " ?"
tab = ","
LF = chr(10)
const ForReading = 1,ForWriting = 2,ForAppending = 3
currentIP = startIP
set shell = CreateObject ("wscript.shell")
Set FS = CreateObject ("scripting.FileSystemObject")
set fx = fs.OpenTextFile(outputfile,ForWriting)
while currentIP <> endIP
command = "cmd /C ping -a " & currentIP & " > " & TempFilename
x = shell.run(command,0,true)
set f = fs.OpenTextFile(tempfilename,ForReading,true)
fline = f.readline
fline = f.readline
l1 = instr (fline," ")
l2 = instr (fline,"[")
if l2 = 0 then
mname = notfound
else
mname = mid (fline,l1,l2-l1)
end if
fxline = currentIP & tab & mname
f.close
fx.writeline(fxline)
zz = currentIP
currentIP = newIP(zz)
wend
fx.close
wscript.echo "Massive ping is ready"
'------------
'function for increasing the IP number
'------------
function newip(xx)
dim n,n1,n2,n3,n4,v1,v2,v3,v4
n = 1
n0 = n
while mid (xx,n,1) <> "."
n =n +1
wend
n1 = n
n = n+1
while mid (xx,n,1) <> "."
n = n+1
wend
n2 = n
n = n+1
while mid (xx,n,1) <> "."
n = n+1
wend
n3 = n
n4 = len(xx)
v1 = mid (xx,n0,n1-1)
v2 = mid (xx,n1+1,n2-n1-1)
v3 = mid (xx,n2+1,n3-n2-1)
v4 = mid (xx,n3+1,n4-n3)
v4 = v4+1
if v4 >255 then
v3 = v3+1
v4 = 0
end if
if v3 > 255 then
v2 = v2+1
v3 = 0
v4 = 0
end if
if v2 > 255 then
v1 = v1+1
v2 = 0
v3 = 0
v4 = 0
end if
return = (v1 & "." & v2 & "." & v3 & "." & v4)
newIP = return
end function
now i would like the script to add the serial number , the username and which service pack it runs .
The user profiles have no admin rights
can some give me a direction
this is what i have so far
TempFilename = "c:\IPtemp.txt"
outputfile = "c:\output.txt"
startip = "193.53.107.2"
endip = "193.53.107.10"
notfound = " ?"
tab = ","
LF = chr(10)
const ForReading = 1,ForWriting = 2,ForAppending = 3
currentIP = startIP
set shell = CreateObject ("wscript.shell")
Set FS = CreateObject ("scripting.FileSystemObject")
set fx = fs.OpenTextFile(outputfile,ForWriting)
while currentIP <> endIP
command = "cmd /C ping -a " & currentIP & " > " & TempFilename
x = shell.run(command,0,true)
set f = fs.OpenTextFile(tempfilename,ForReading,true)
fline = f.readline
fline = f.readline
l1 = instr (fline," ")
l2 = instr (fline,"[")
if l2 = 0 then
mname = notfound
else
mname = mid (fline,l1,l2-l1)
end if
fxline = currentIP & tab & mname
f.close
fx.writeline(fxline)
zz = currentIP
currentIP = newIP(zz)
wend
fx.close
wscript.echo "Massive ping is ready"
'------------
'function for increasing the IP number
'------------
function newip(xx)
dim n,n1,n2,n3,n4,v1,v2,v3,v4
n = 1
n0 = n
while mid (xx,n,1) <> "."
n =n +1
wend
n1 = n
n = n+1
while mid (xx,n,1) <> "."
n = n+1
wend
n2 = n
n = n+1
while mid (xx,n,1) <> "."
n = n+1
wend
n3 = n
n4 = len(xx)
v1 = mid (xx,n0,n1-1)
v2 = mid (xx,n1+1,n2-n1-1)
v3 = mid (xx,n2+1,n3-n2-1)
v4 = mid (xx,n3+1,n4-n3)
v4 = v4+1
if v4 >255 then
v3 = v3+1
v4 = 0
end if
if v3 > 255 then
v2 = v2+1
v3 = 0
v4 = 0
end if
if v2 > 255 then
v1 = v1+1
v2 = 0
v3 = 0
v4 = 0
end if
return = (v1 & "." & v2 & "." & v3 & "." & v4)
newIP = return
end function