Page 1 of 2 12>
Topic Options
#104952 - 2003-09-20 06:00 AM Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
[Moderator (Sealeopard): Moved topic from 'Scripts' to 'General' forum due to lack of script in body]

I have the registry search down, but does anyone have any tips/suggestions on how to append those results to a text/.csv? Does that need to be run in a logon script or is there a way to scan the network at any given time? Any help would be greatly appreciated.

[ 22. September 2003, 21:13: Message edited by: sealeopard ]

Top
#104953 - 2003-09-20 06:09 AM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sure, you can scan net at any given time.
with many clients the search can take quite a long time.
with about 1000 it takes about 7-10mins
and there is no quarantee the machines are on at that time.

writing to file is nothing but open(),writeline() and close() calls.
_________________________
!

download KiXnet

Top
#104954 - 2003-09-20 06:14 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
Great. Thank you for the info. I found a sample from Robbie that I'm using as an example, but I am still learning. How do you scan the network at any given time? I don't know how to do that at all.

Thanks again.

Top
#104955 - 2003-09-20 06:19 AM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
for this you have many ways.
with AD it's simple (doh, not), you just crawl it.

with old good NT you need to scan network environment.
like, netview2() and then use that info to read the registry.
_________________________
!

download KiXnet

Top
#104956 - 2003-09-20 06:22 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
No AD. W2k domain though. This is waht I have, if you don't mind reviewing. Again, I'm using Robbie's example, don't want to take any undo credit. Please be easy, I'm a rookie.

;Check for Patch
$regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB824146", "Description"
$patch="\\server\patch\%computername%\patch.txt"
$logdir="\\server\patch\%computername%"
$patch= ReadValue("$regkey", "Windows 2000 Hotfix - KB824146")
IF $proxen = "1"
md "$logdir"
Redirectoutput("$patch",1)
? "************************************"
? "Search for Windows 2000 Hotfix - KB824146"
? "************************************" ? "Time : "+ @TIME
? "Date : "+ @DATE ? "Registry Key : "+ $regkey+"Windows 2000 Hotfix - KB824146"
? "Registry Value : "+ $patch
? "Computer Name : "+ %COMPUTERNAME%
? "User Name : "+ %USERNAME%

Endif
exit

[ 20. September 2003, 06:41: Message edited by: RVS42 ]

Top
#104957 - 2003-09-20 06:47 AM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, your inventory piece would be something like:
;hotfix Scanner
;########################
$hotfix="KB824146"
$type="SP5" ; pre sp5 hotfix

$rc=open(1,"\\server\patch\"+$hotfix,5)
$regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\"+$type+"\"+$hotfix
for each $machine in netview2()
if "Windows 2000 Hotfix - KB824146"=ReadValue("\\"+$machine+"\"+$regkey, "Description")
$rc=writeline(1,$machine+","+ReadValue("\\"+$machine+"\"+$regkey, "InstalledDate"+@crlf)
else
$rc=writeline(1,$machine+",not installed"+@crlf)
Endif
next
$rc=close()


[ 20. September 2003, 07:17: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#104958 - 2003-09-20 07:15 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
What is the rc command on the 6th line down?
Top
#104959 - 2003-09-20 07:19 AM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not sure what you mean.
if you talk about $rc, it is not command but variable.
it gets feeded with the return codes of the functions thus they won't be thrown onto console window or such.
_________________________
!

download KiXnet

Top
#104960 - 2003-09-20 07:23 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
I copied the script you supplied and am trying to use it. However, it errors on that RC line and reports "error in parameters." I hate to keep bugging, but it is extremely important (in my world at least) to get this running.

Not sure what step to take next.

Top
#104961 - 2003-09-20 07:25 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
Can you explain to me "@crlf?"

thanks

Top
#104962 - 2003-09-20 07:25 AM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja, copy again.
I had quote mismatch I just fixed.
_________________________
!

download KiXnet

Top
#104963 - 2003-09-20 07:28 AM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you might want to look at kixtart manual.
$ - variable
@ - macro

looking for @crlf macro in the manual explains what it means.
I give you a change to check it up, so you will learn to use it.
you could also use the keyword ref:
http://kixtart.org/manual_index.html
_________________________
!

download KiXnet

Top
#104964 - 2003-09-20 07:34 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
Thank you. I get the same parameter error on

$rc=writeline(1,$machine+",not installed"+@crlf)

Any thoughts?

Top
#104965 - 2003-09-20 07:37 AM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quick quess is that you use so old kixtart that it does not support @crlf.
but that sounds weird as it would be years old version.
_________________________
!

download KiXnet

Top
#104966 - 2003-09-20 07:38 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
you're right. v 3.75
Top
#104967 - 2003-09-20 07:58 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17
ok, the file is created, but it's empty.
Suggestions?

Top
#104968 - 2003-09-20 08:07 AM Re: Registry Search Output
RVS42 Offline
Fresh Scripter

Registered: 2003-09-20
Posts: 17


[ 20. September 2003, 09:06: Message edited by: RVS42 ]

Top
#104969 - 2003-09-20 10:42 PM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
found another error in the script, this should work better:
;hotfix Scanner
;########################
$hotfix="KB824146"
$type="SP5" ; pre sp5 hotfix

$rc=open(1,"\\server\patch\"+$hotfix,5)
$regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\"+$type+"\"+$hotfix
for each $machine in netview2()
if "Windows 2000 Hotfix - KB824146"=ReadValue("\\"+$machine+"\"+$regkey, "Description")
$rc=writeline(1,$machine+","+ReadValue("\\"+$machine+"\"+$regkey, "InstalledDate")+@crlf)
else
$rc=writeline(1,$machine+",not installed"+@crlf)
Endif
next
$rc=close(1)


[ 21. September 2003, 03:54: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#104970 - 2003-09-20 10:47 PM Re: Registry Search Output
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
quote:
you're right. v 3.75
You're wrong! There was never ever such a version of KiX.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#104971 - 2003-09-20 10:52 PM Re: Registry Search Output
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now, isn't that old if it never was? [Wink]
_________________________
!

download KiXnet

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 1046 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.072 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

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