Sign in to follow this  
Followers 0
this-is-me

Detect multiple users on 2k/XP

13 posts in this topic

I need to have my au3 script set up an autologon only if there is more than one user that logs on to the system. How can I find out from the registry only if there is more than one user? What keys or values do I look for to find out what users are available?


Who else would I be?

Share this post


Link to post
Share on other sites



check the output of "net user"

Share this post


Link to post
Share on other sites

I don't want to use net user. That is why I asked for a registry only method. Did you even read the whole post?


Who else would I be?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

what is with:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList?

You query it with RegEnumKey and read then OptimizedLogonStatus

This seems only to exist on 'normal' profiles.

Maybe the Flags-entry is special for 'normal' profiles, at my pc it's only "0" for these.

For other profiles it is 9 and 12 here...

Edit: or you check the length of the RegEnumKey-Key....

Edited by Holger

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I think 12 is system and 9 is service. Each normal user is 0, and I think you gave me the info I needed.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

What meanedwith the OptimizedLoginState

I have values of 5,10 and 11

Share this post


Link to post
Share on other sites

Completed scrap - Purpose is to check existance of more than one user on 2000/XP besides the admin account.

$num = 1
$tot = 0
While 1
    $k = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", $num)
    if @error then exitloop
    if StringInStr($k, "S-1-5-21-") Then
  $m = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & $k, "ProfileImagePath")
  if not @error then
     if not StringInStr($m, "Administrator") then
    $tot = $tot + 1
    if $tot >= 2 then
     msgbox(0,"","More than one user...")
     ExitLoop
    EndIf
     EndIf
  EndIf
    EndIf
    $num = $num + 1
wend

Who else would I be?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Hey I just noticed something if you look at the code it looks like a pistol! :ph34r:

A 9mm to exact. :lol:

I also noticed that in the subkeys that there is a binary value named state which in my reg (xp sp2) value 0x00000000 is for a service and a value of 0x00000256 was for an actual user.

Just somethin I noticed and don't know if it will make things easier. :(

Edited by Triton

Triton

Share this post


Link to post
Share on other sites

Maybe that guy in your avatar can use it...


Who else would I be?

Share this post


Link to post
Share on other sites

Yes, some days I do need it to shoot my co-works! :ph34r:


Triton

Share this post


Link to post
Share on other sites

rofl... ok, next coding challenge...

make some (working) code, that does something usefull, appear to look like a smiley face.


Sitting comfortably behind the code.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0