#88649 - 2002-10-11 05:10 PM
Investor 1.2.3 - Power of MultiProcessing
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
k... it's done and I could start doing my work. the first run is little bit hard but once cache is there, queries are fast and easy.
Investor - Collects software information from your network
how? - investor takes your network neighborhood info from net view. it then reads from every machine, every installer program (the ones that you can see from add/remove programs list) all info is also dynamic. when programs added/removed or totally new programs come along (hot fixes , sp , etc...) it will know them first.
speed? - investor uses multiprocessing. it uses all the network speed and processor power your wksta has to collect the info as fast as possible. it also has cache from which you can view the pre collected info at any time.
impact on the machines - none! it does not affect the machines in any way. no info or anything else is written nor put to remote machine. nor does it use your network resources. only place is the wksta you are running. and only place there is the registry.
known issues - slowness. it can take on >1000 machine network 10 minutes to run it only scans computers with remote admin/registry support (all nt-line and post installed win9x)
code:
;Investor 1.2.3 (2002-10-13) ;Author Lonkero ;location of kix executable: $location="@scriptdir\wkix32" ;################################################# $root="HKEY_LOCAL_MACHINE\software\jooel\investor" $main=createobject("kixtart.form") $main.size=$main.screen.width,$main.screen.height-taskbar() $main.caption="Investor 1.2.3" $main.borderstyle=1 $main.backcolor=&e7,&e7,&e0 $main.top=0 $main.left=0 $width=$main.clientwidth $height=$main.clientheight $exit=$main.button("Exit",$width-90,20,75,20) $exit.onclick="$$main.visible=0" $exit.Appearance=0 if keyexist($root) $viewb=$main.button("View Cached info",$width/2-110,20,100,20) $viewb.onclick="view()" $viewb.Appearance=0 $clear=$main.button("Clear Cache",$viewb.right+20,20,75,20) $clear.onclick="$$nul=deltree('$root') $$clear.hide $$viewb.hide" $clear.Appearance=0 endif $start=$main.button("Start scan",10,20,75,20) $start.onclick="collect()" $start.Appearance=0 $main.visible=1 while $main.visible $=execute($main.doevents) loop function collect() $start.visible=0 dim $machine,$program,$check,$c,$label,$bar,$,$machines,$barReady,$labelReady,$nul shell '%comspec% /c net view|find "\\" > "%temp%\investor_kix.tmp"' $=open(1,"%temp%\investor_kix.tmp") $=readline(1) while @error=0 $machine=split($) $machines=$machines+$machine[0]+chr(10) if $main.visible $=execute($main.doevents(1)) endif $=readline(1) loop $=close(1) del "%temp%\investor_kix.tmp" $machines=split(left($machines,len($machines)-1),chr(10)) $label=$main.label(,10,2,200,15) $bar=$main.progressbar(,10,20,$width-110,20) $bar.style=1 $bar.min=0 $bar.max= ubound($machines) $bar.value=0 $label.caption="scanning the machines... 0/"+$bar.max $labelReady=$main.label(,10,40,200,15) $barReady=$main.progressbar(,10,57,$width-110,20) $barReady.style=0 $barReady.min=0 $barReady.max= ubound($machines) $barReady.value=0 $labelReady.caption="Collecting the info... " for $=0 to ubound($machines) if mem() del "%temp%\"+$+".inv" $machine=$machines[$] $nul=open(1,"%temp%\"+$+".inv",5) $check=$machine+'\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' $nul=writeline(1,'if exist("$machine\admin$$") ') $nul=writeline(1,'$$nul=delvalue("$root","$machine") ') $nul=writeline(1,"$$value=enumkey('$check',0) ") $nul=writeline(1,"$$c=0 ") $nul=writeline(1,"while @@error=0 ") $nul=writeline(1,"$$c=$$c+1 ") $nul=writeline(1,'$$value=readvalue("$check"+"\"+$$value,"DisplayName") ') $nul=writeline(1,"if $$value $$nul=writevalue('$root\'+$$value,'$machine','1','REG_SZ') endif ") $nul=writeline(1,"$$value=enumkey('$check',$$c) ") $nul=writeline(1,"loop ") $nul=writeline(1,"$$nul=writevalue('$root','$machine','@date','REG_SZ') ") $nul=writeline(1,"endif ") $nul=writeline(1,'del "%temp%\'+$+'.inv"') $nul=close(1) run '$location "%temp%\'+$+'.inv"' if $main.visible $nul=execute($main.doevents(1)) else exit 0 endif $label.caption="scanning the machines... "+$+"/"+$bar.max $bar.value=$ else $=$-1 $label.caption="scanning the machines... "+$+"/"+$bar.max+" (memory halt)" $nul=execute($main.doevents(1)) sleep 0.2 endif next for $=1 to ubound($machines) sleep 0.1 if exist("%temp%\"+$+".inv") $=$-1 else $barReady.value=$ endif if $main.visible $nul=execute($main.doevents(1)) else exit 0 endif next redim $machine,$program,$check,$c,$label,$bar,$,$machines,$barReady,$labelReady,$nul view() endfunction function view() $start.visible=0 $viewb=0 $clear=0 dim $all,$selected,$middle,$modify,$add,$remove,$addall,$removeall,$show,$value,$c,$selections,$summary,$item,$ $all=$main.listbox(,10,50,($width-200)/2,$height-60) $selected=$main.listbox(,$width-($width-200)/2-10,50,($width-200)/2,$height-60) $c=0 $=enumvalue($root+"\selected",0) while @error=0 $c=$c+1 $selections=$selections+$+chr(10) $selected.additem($value) $value=enumvalue($root+"\selected",$c) loop $c=0 $value=enumkey($root,$c) while @error=0 $c=$c+1 $clear=1 for each $ in split($selections,chr(10)) if $=$value $clear=0 endif next if $clear $all.additem($value) endif $value=enumkey($root,$c) loop $all.listindex=0 $selected.listindex=0 $middle=$selected.left-$all.right-20 $add=$main.button(">> Add >>",$all.right+10,60,$middle,25) $add.Appearance=0 $add.onclick="$$selected.additem($$all.value) $$all.removeitem($$all.listindex) $$all.listindex=0" $addall=$main.button(">> Add All >>",$all.right+10,90,$middle,25) $addall.onclick="move($$all,$$selected)" $addall.Appearance=0 $remove=$main.button("<< Remove <<",$all.right+10,130,$middle,25) $remove.Appearance=0 $remove.onclick="$$all.additem($$selected.value) $$selected.removeitem($$selected.listindex) $$selected.listindex=0" $removeall=$main.button("<< remove All <<",$all.right+10,160,$middle,25) $removeall.Appearance=0 $removeall.onclick="move($$selected,$$all)" $show=$main.button("Show Selected",$all.right+10,$height-50,$middle,25) $show.Appearance=0 $show.onclick="$$all.hide" ;$summary=$main.checkbox("Add Summary Line",$all.right+10,200,$middle,25) while $all.visible $=execute($main.doevents) loop $selected.hide $add.hide $addall.hide $remove.hide $removeall.hide $show.hide ;$summary.hide for $c=0 to $selected.listcount $selected.listindex=$c if $selected.value $=writevalue($root+"\selected",$selected.value,"1","REG_SZ") endif next $table=$main.listview(,10,50,$width-20,$height-60) $table.columns.count=$selected.listcount+1 $table.columns(0).text="Machine" $table.columns(0).alignment=0 for $=0 to $selected.listcount $selected.listindex=$ $table.columns($+1).text=$selected.value $table.columns($+1).alignment=2 $table.columns($+1).width=-2 next
$c=0 $value=enumvalue($root,$c) while @error=0 and $main.visible $c=$c+1 if len(readvalue($root,$value)) $item=$table.items.add($value) for $=0 to $selected.listcount $selected.listindex=$ if len(readvalue($root+"\"+$selected.value,$value)) $item.subitems($+1).text="X" endif next endif loop
$table.columns(0).width=-1 $=execute($main.doevents(1)) endfunction ;check available memory function mem() dim $object,$items,$item $mem=0 $object = GetObject("winmgmts:\\.\root\cimv2") $items = $object.ExecQuery("Select * from Win32_PerfRawData_PerfOS_Memory",,48) For each $item in $items if val($item.AvailableMBytes)>5 $mem=1 endif next endfunction ;return taskbar height Function TaskBar() dim $_S If @dos=="4.0" $_S="StuckRects" Else $_S="StuckRects2" EndIf $TaskBar=Val("&"+SubStr(ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\$_S","settings"),41,2)) EndFunction ;from list to another. all. function move($from, $to) dim $ for $=0 to $from.listcount $from.listindex=$ $to.additem($from.value) next $from.clear endfunction
still needed, still to come: -summary line -get only summary -print -email -save -date stamp to cache (30 days?) [ 13. October 2002, 17:25: Message edited by: Lonkero ]
_________________________
!download KiXnet
|
Top
|
|
|
|
#88652 - 2002-10-11 06:30 PM
Re: Investor 1.2.3 - Power of MultiProcessing
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
|
Top
|
|
|
|
#88660 - 2002-10-12 02:04 AM
Re: Investor 1.2.3 - Power of MultiProcessing
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11625
Loc: CA
|
So where is all this writing happening? Were not writing to remote registries here are we?
As long as it has NO impact on the remote machines I'll try to test it out early next week... It's the weekend now
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 2145 anonymous users online.
|
|
|