Jump to content

Detect multiple users on 2k/XP


Recommended Posts

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?
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Yeah, maybe thats only what you need...cause at my PC there are only profiles in this list which have a real personal folder you know (after logon)...

Edited by Holger
Link to comment
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?
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...