Page 1 of 1 1
Topic Options
#88649 - 2002-10-11 05:10 PM Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
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
#88650 - 2002-10-11 05:11 PM Re: Investor 1.2.3 - Power of MultiProcessing
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
'$remove.hdie', is this a typo?
_________________________
There are two types of vessels, submarines and targets.

Top
#88651 - 2002-10-11 05:15 PM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it was typo.
didn't see it as does not affect cause the remove is dimmed...
thanks anyway.
_________________________
!

download KiXnet

Top
#88652 - 2002-10-11 06:30 PM Re: Investor 1.2.3 - Power of MultiProcessing
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
BTW... what does it do?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#88653 - 2002-10-11 07:23 PM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hehee...
fixed lack of info.
_________________________
!

download KiXnet

Top
#88654 - 2002-10-11 07:58 PM Re: Investor 1.2.3 - Power of MultiProcessing
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Lonkero,

What about verifying the system is on line and accessable before attempting to scan it?

Top
#88655 - 2002-10-11 08:05 PM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it is there.
if I add ping to this, it will reduce the time... 1 sec per offline machine.
on the other hand, it will increase the time online machines takes to scan.

anyway, as there is multiple processes running at the same time as mainscript checks if the machine is available (approx. 2-5 secs) the scanning will not stop. the process priority just changes to keep up the maximum volume.

{edit}
if I can make the ping fast enough, that could be added...
will see. it can't have any disk access as then there is no benefit using it.
neither it can use wsh as not all have it enabled (nor I want to use it...)

[ 11. October 2002, 20:08: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#88656 - 2002-10-11 11:10 PM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
kent, did you try the new formula already?

would be nice to see if there is any speed advantage...
 
_________________________
!

download KiXnet

Top
#88657 - 2002-10-12 12:28 AM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, made 1.2.1 with ping, it got slower.
even if I add parts to the separate files and leave out from the main script.
no go with that.
_________________________
!

download KiXnet

Top
#88658 - 2002-10-12 12:41 AM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
heh, made the 1.2 fully with testing only with cache.
the scan part does not work!
anyway, it seems that I've got pretty fast way (seemed multiple seconds faster on just 20 machines)
_________________________
!

download KiXnet

Top
#88659 - 2002-10-12 01:04 AM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
1.2.2 released
in 1.2 the collection was broken, so no-one except me could actually use it. fixed.

checking of computer online status and remote admin moved to separate file which speeds up the overall runtime even on small networks.

one of the oldies/regulars (kent, doc, rad or patrick) could check if it is working on their system too.

most importantly, is the speed ok or should I keep on fighting?
_________________________
!

download KiXnet

Top
#88660 - 2002-10-12 02:04 AM Re: Investor 1.2.3 - Power of MultiProcessing
NTDOC Administrator Offline
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 [Big Grin]

Top
#88661 - 2002-10-12 02:09 AM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
only affect on the remote reg is the enumval.

if your query wksta is enough fast and your pdc uses ISDN line, you can kill it [Wink]

no, no writing anywhere else but into the "DB" on local machine.

I'm still thinking of updating with actual db but have to study how slow it actually would then be.
to really make this "ok", it would be perfect to dedicate one PII wksta for this.

once I get the cache info update interval implemented it should be better source for info on programs than SMS.

{edit}
well, not maybe better... cheeper and KiX

[ 12. October 2002, 02:17: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#88662 - 2002-10-14 12:58 AM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
problem found with indexing...
have to correct...
_________________________
!

download KiXnet

Top
#88663 - 2002-10-13 05:06 PM Re: Investor 1.2.3 - Power of MultiProcessing
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Digging in the code...

Jooel, I'll let you know in what way I can support you.
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#88664 - 2002-10-13 05:07 PM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hey, wait a sec.

I'm just updating the code (problems with current one. the cache will show wrong info!)

I'm just finishing 1.2.3
_________________________
!

download KiXnet

Top
#88665 - 2002-10-13 05:27 PM Re: Investor 1.2.3 - Power of MultiProcessing
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh...
tested with local computer only and there is some problem loading the stuff from reg...

but with multiple computer it should do.

could test with this version (updated the first post)

cheers.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 202 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.067 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org