Page 1 of 1 1
Topic Options
#163590 - 2006-06-23 05:12 PM list of local user profiles
morla Offline
Lurker

Registered: 2006-06-23
Posts: 3
helloe all,
i'm new to kixtart, so i'll post my question here... first of all
kixtart rock's like hell!!!

so now to my question,
is it possibel to get a list of all 'local user profiles'(sorry for my bad english) that are located/installed on a client machine???

how would u code that?? is there a macro or something?

any help would be appreciated

thx
i <3 kixtart

Top
#163591 - 2006-06-23 05:20 PM Re: list of local user profiles
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You can find it in the reg.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163592 - 2006-06-23 05:23 PM Re: list of local user profiles
morla Offline
Lurker

Registered: 2006-06-23
Posts: 3
cool man!!! thats great!
hmm.. i'm relativly new to windows OS, how can i learn more about the registry?

^i'll try that now...

Top
#163593 - 2006-06-23 05:41 PM Re: list of local user profiles
morla Offline
Lurker

Registered: 2006-06-23
Posts: 3
hmm.. ok. i had a look in the registry...
under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
there are alot strange numbers (hrm. i guess kind of sid or so...)
i'd like to just extrackt the userid or the name of the users that have a local profile...
how do i work myselfe through al the folders under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
????

i have no clue...
thank u in advance

Top
#163594 - 2006-06-23 07:28 PM Re: list of local user profiles
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
with enumkey and some looping.

but, you won't get no userID or username from there.
you will only get the profile folder (which is some sorta construct of the userID though)
_________________________
!

download KiXnet

Top
#163595 - 2006-06-23 07:51 PM Re: list of local user profiles
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Once you enumerate the keys (sids) under ProfileList, pass them to SidToName() for a translation to domain\user format.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#163596 - 2006-06-23 09:05 PM Re: list of local user profiles
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
You could also try running something like this to see all the names of the profiles.

Dim $ProL,$PL,$Tmp,$DV
$ProL = ExpandEnvironmentVars(ReadValue('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList','ProfilesDirectory'))
$PL = Dir($ProL)
While $PL <>'' And @ERROR = 0
If $PL
If Not InStr($PL,'.') And Not InStr($PL,'..')
$PL ?
EndIf
EndIf
$PL = Dir()
Loop

Top
#163597 - 2006-06-23 09:36 PM Re: list of local user profiles
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
That is just a list of folders. Not necessarily proper profiles as per what is listed in the reg.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163598 - 2006-06-23 10:17 PM Re: list of local user profiles
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
the sidtoname sounds actually the simpliest way to go...
_________________________
!

download KiXnet

Top
#163599 - 2006-06-23 11:59 PM Re: list of local user profiles
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
True, but sort of depends on what you want the information for I suppose.  I've seen folders there that are not in the registry too (probably due to some tech messing with it, or poorly behaved app)
Top
#163600 - 2006-06-24 12:25 AM Re: list of local user profiles
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
or just simply broken profile or reinstalled windows or...
if it's not in the registry, it does not matter to windows as it is not a profile dir.
on the other hand, it can have some personal information in it.
for data retrieval purposes, those folders may hold some meaning.
_________________________
!

download KiXnet

Top
#163601 - 2006-06-24 01:00 AM Re: list of local user profiles
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Okay, round 2. Is this better?

Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $BaseKey,$DataKey,$UserID
Dim $ArrayBaseKey,$Key,$Profile
Dim $DataSid,$ProfileSID
$BaseKey = 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\'
$DataKey = 'ProfileImagePath'
$DataSid = 'Sid'
$ArrayBaseKey = ArrayEnumKey($BaseKey)
For Each $Key In $ArrayBaseKey
If $Key
$Profile = Split(ReadValue($BaseKey+$Key,$DataKey),'\')[2]
$ProfileSID = ReadValue($BaseKey+$Key,$DataSid)
'SID2Name: ' SidToName($Key) ?
'Registry Account Name: ' + $Profile ?
'SID: ' + $Key ?
'SID (REG value): ' + $ProfileSID ??
EndIf
Next

Function ArrayEnumValue($regsubkey)
Dim $retcode, $valuecounter, $currentvalue, $valuearray
If Not KeyExist($regsubkey)
Exit 87
EndIf
$valuecounter=0
Do
$currentvalue=EnumValue($regsubkey,$valuecounter)
If Not @ERROR
ReDim PreServe $valuearray[$valuecounter]
$valuearray[$valuecounter]=$currentvalue
$valuecounter=$valuecounter+1
EndIf
Until @ERROR
$arrayenumvalue=$valuearray
Exit 0
EndFunction

Function arrayenumkey($regsubkey)
Dim $retcode, $subkeycounter, $currentsubkey, $subkeyarray
If Not KeyExist($regsubkey)
Exit 87
EndIf
$subkeycounter=0
Do
$currentsubkey=EnumKey($regsubkey,$subkeycounter)
If Not @ERROR
ReDim PreServe $subkeyarray[$subkeycounter]
$subkeyarray[$subkeycounter]=$currentsubkey
$subkeycounter=$subkeycounter+1
EndIf
Until @ERROR
$arrayenumkey=$subkeyarray
Exit 0
EndFunction



Edited by NTDOC (2006-06-24 02:48 AM)

Top
#163602 - 2006-06-24 02:39 AM Re: list of local user profiles
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Doc, did you test that? All you need to do is take the text Sid (name of profilelist subney) and pass that to SidToNAme().

[edit] After a re-read, it looks good. [/edit]


Edited by Howard Bullock (2006-06-24 02:43 AM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#163603 - 2006-06-24 02:43 AM Re: list of local user profiles
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Yes I tested it. The SID that it returns from the REG is some other format and NOT the SID required to show it from KiXtart conversion. I just wanted to go ahead and display that too, but I suppose it could be confusing as it's not the same.

It returns 3 formats. Like this...

Code:
Registry Account Name: LocalService
SID2Name: LOCAL SERVICE
Account SID: 010100000000000513000000



Did YOU run it

Give it a try and you should see it works just fine.

Top
#163604 - 2006-06-24 02:44 AM Re: list of local user profiles
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Yeah, that sid is in Hex format.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#163605 - 2006-06-24 02:49 AM Re: list of local user profiles
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Okay, updated the code above a little. Here is sample output.


Code:
SID2Name: LOCAL SERVICE
Registry Account Name: LocalService
SID: S-1-5-19
SID (REG value): 010100000000000513000000


Top
#163606 - 2006-06-24 03:38 AM Re: list of local user profiles
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what does "registry account name" mean?
_________________________
!

download KiXnet

Top
#163607 - 2006-06-24 04:14 AM Re: list of local user profiles
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Well if we look at the code we see that it reads this from the registry ProfileImagePath which typically is just the FOLDER name.

SidToName on the otherhand also gives the Domain the account comes from.


JOHNDOE
 vs.
SOMEDOMAIN\JOHNDOE
 


Edited by NTDOC (2006-06-24 04:16 AM)

Top
#163608 - 2006-06-24 04:53 AM Re: list of local user profiles
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
but...
looking at the code, it would not always return "JOHNDOE"
sometimes it will also return "JOHNDOE.SOMEDOMAIN" or "JOHNDOE.SOMEDO~1" or something alike.
_________________________
!

download KiXnet

Top
#163609 - 2006-06-24 06:56 AM Re: list of local user profiles
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Only if it's in the Registry which would be a VALID profile whether or not it was from corruption or whatever.

Not sure what your point is Jooel. This is just an exercise in showing various ways of getting the data requested.

I don't see any "specifics" of include/exclude requirements, or even a reply since I posted this code except from us regulars.

If / When such stringent requirements are provided then he can hopefully have at least an idea of how to constrain the data to his requirements, which is better than just generalizations on how to do it.

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 (Allen) and 382 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.075 seconds in which 0.024 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