Page 1 of 1 1
Topic Options
#119640 - 2004-05-15 03:55 AM Reading REG_MULTI_SZ values in registry
japccna Offline
Fresh Scripter

Registered: 2004-05-15
Posts: 5
I am trying to enumerate the shares on a users computer system when a user logs in. Here is the key I want to enumerate-$KEY = ENUMKEY("HKey_Local_Machine\System\CurrentControlSet\Services\lanmanserver\shares", $INDEX). All I get is Security, which is a subkey under Shares. I can see the shares in the registry but can't seem to extract the data....HELP
Top
#119641 - 2004-05-15 03:57 AM Re: Reading REG_MULTI_SZ values in registry
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Your only showing us part of your code, are you incrementing $index by one etc ? Lets see the entire routine.
Top
#119642 - 2004-05-15 04:06 AM Re: Reading REG_MULTI_SZ values in registry
japccna Offline
Fresh Scripter

Registered: 2004-05-15
Posts: 5
I got disgusted and deleted most of it. Here it is.

? "Running Script #8 - Shares.kix"
$INDEX = 0
:SWLOOP
$KEY = ENUMKEY("HKey_Local_Machine\System\CurrentControlSet\Services\lanmanserver\shares", $INDEX)
? $KEY
If @Error = 0
; $shares = $key
$INDEX = $INDEX + 1
GOTO SWLOOP

Here is what is returned to my text file>
Running Script #8 - Shares.kix
Security

Top
#119643 - 2004-05-15 04:19 AM Re: Reading REG_MULTI_SZ values in registry
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Problem is you don't know your keys from your values. In Regedit, the keys are in the left pane, the values in the right pane. There is a FAQ on that.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#119644 - 2004-05-15 04:24 AM Re: Reading REG_MULTI_SZ values in registry
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Maybe I should elaborate...
EnumKey( )
Action: Allows you to list the names of the subkeys contained in a registry key or subkey.

EnumValue( )
Action: Allows you to list the names of the registry entries contained in a specific key or subkey.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#119645 - 2004-05-15 04:25 AM Re: Reading REG_MULTI_SZ values in registry
japccna Offline
Fresh Scripter

Registered: 2004-05-15
Posts: 5
This code works fine. I am pulling data from "DisplayName and DisplayVersion"

$INDEX = 0
:SWLOOP
$KEY = ENUMKEY("HKey_Local_Machine\Software\Microsoft\Windows\CurrentVersion\Uninstall", $INDEX)
If @Error = 0
$PATH = "HKey_Local_Machine\Software\Microsoft\Windows\CurrentVersion\Uninstall\" + $KEY
SELECT
CASE EXISTKEY($PATH + "\DisplayName")
$CACname = READVALUE($PATH,"DisplayName")
$CACversion = READVALUE($PATH,"DisplayVersion")
IF EXISTKEY($PATH + "\Uninstall String") AND $CACname = "ActivCard Gold"
$CACReader = $CACname + " Version - " + $CACversion + @CRLF
ENDIF

EndSelect
$INDEX = $INDEX + 1
GOTO SWLOOP
ENDIF

Top
#119646 - 2004-05-15 04:28 AM Re: Reading REG_MULTI_SZ values in registry
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
...and the FAQ
Registry
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#119647 - 2004-05-15 04:29 AM Re: Reading REG_MULTI_SZ values in registry
japccna Offline
Fresh Scripter

Registered: 2004-05-15
Posts: 5
Dude, way to cool, that was all I needed to change. My text file now looks like this...

Running Script #8 - Shares.kix
print$
MusicServer$
HPDJ845
NetAcademy$

Thanks a gazillion.

Top
#119648 - 2004-05-15 04:31 AM Re: Reading REG_MULTI_SZ values in registry
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You're just not getting it. Rather than standing blindly behind your code, open your eyes.

[edit] forget what I said... looks like you figured it out. WHy not post the revised code for others that may come upon this.


Edited by Les (2004-05-15 04:33 AM)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#119649 - 2004-05-15 04:43 AM Re: Reading REG_MULTI_SZ values in registry
japccna Offline
Fresh Scripter

Registered: 2004-05-15
Posts: 5
Thanks again, here is the entire script.. it is called by another script that defines the logfile.

; Script # 8 (Shared Resources per machine)
? "Running Script #8 - Shares.kix"
;###############################################################################################
; TAKING INVENTORY OF Shared Resources
;
; 2004/05/14 -Written to display the systems shared resources - TSG Payne
;
;###############################################################################################
? "Shared resources for - @wksta"
$INDEX = 0
:SWLOOP
$shareskey = ENUMVALUE("HKey_Local_Machine\System\CurrentControlSet\Services\lanmanserver\shares", $INDEX)
? $shareskey
If @Error = 0
$INDEX = $INDEX + 1
GOTO SWLOOP

Here's the output to the text file.

Running Script #8 - Shares.kix
Shared resources for - 2252K80040031WB
print$
MusicServer$
HPDJ845
NetAcademy$

Top
#119650 - 2004-05-15 05:26 AM Re: Reading REG_MULTI_SZ values in registry
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Juck, GOTOs! :-(

You should rather take a look at the UDF Forum , e.g. the ArrayEnumValue() UDF.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.073 seconds in which 0.037 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