Search code examples
windowsvbscriptregistrywmi

Getting the Username from the HKEY_USERS values


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 in VBScript.


Solution

  • 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.