Getting the Username from the HKEY_USERS values

前端 未结 9 1019
予麋鹿
予麋鹿 2021-01-30 04:08

Is there a way to connect between the values under HKEY_USERS to the actual username?
I saw some similar questions, but most (if not all) talks about C# code, and my need is

相关标签:
9条回答
  • 2021-01-30 04:38
    1. Open Reg HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\

    2. make a loop to get all subkeys

    3. the subkeys you are interested with are those started with [S-1-5-21-] which means user (see key name [ProfileImagePath] they are always started with a path c:\Users)

    4. Those starting with [S-1-5-21-12] are all local users

    5. Those starting with [S-1-5-21-13] are all network users [if joined to Domained network] that are previously logged on the machine.

    0 讨论(0)
  • 2021-01-30 04:39
    for /f "tokens=8 delims=\" %a in ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist" ^| find "UsrClass.dat"') do echo %a
    
    0 讨论(0)
  • 2021-01-30 04:45

    By searching for my userid in the registry, I found

    HKEY_CURRENT_USER\Volatile Environment\Username
    
    0 讨论(0)
  • 2021-01-30 04:47

    If you look at either of the following keys:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist

    You can find a list of the SIDs there with various values, including where their "home paths" which includes their usernames.

    I'm not sure how dependable this is and I wouldn't recommend messing about with this unless you're really sure what you're doing.

    0 讨论(0)
  • 2021-01-30 04:47

    In the HKEY_USERS\oneyouwanttoknow\ you can look at \Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders and it will reveal their profile paths. c:\users\whothisis\Desktop, etc.

    0 讨论(0)
  • 2021-01-30 04:50

    It is possible to query this information from WMI. The following command will output a table with a row for every user along with the SID for each user.

    wmic useraccount get name,sid
    

    You can also export this information to CSV:

    wmic useraccount get name,sid /format:csv > output.csv
    

    I have used this on Vista and 7. For more information see WMIC - Take Command-line Control over WMI.

    0 讨论(0)
提交回复
热议问题