Figure out user login name in registry HKU

This doc provides a little script to lookup the SID for a user (so that you can browse the right place in the registry).


I couldn't get the above to work - missing a library or something; however the code in this thread worked well:


WScript.Echo "User SID: " & GetUserSID



Function GetUserSID()

  ' Author: Torgeir Bakken

  Dim sUserSID, oWshNetwork, oUserAccount

  Set oWshNetwork = CreateObject("WScript.Network")

  sUserSID = ""

  On Error Resume Next

  Set oUserAccount=GetObject( _

    "winmgmts://" & oWshNetwork.UserDomain & "/root/cimv2") _

    .Get("Win32_UserAccount.Domain='" & oWshNetwork.ComputerName & "'" _

      & ",Name='" & oWshNetwork.UserName & "'")

  GetUserSID = oUserAccount.SID

End Function



Or grab a copy of getsid.exe from Microsoft's Windows 2000 Resource Kit - usage on a standalone workstation appears redundant at first:
getsid \\mylaptop lchan \\mylaptop lchan

tags: sid, user, getsid.exe, !guid

Related Scribbles:
  • Registry Tools

  • ID: 767
    Date Updated:
    2016-04-17 18:11:21
    Date Created:
    2006-04-27 12:10:26


     >> Leonard Chan's Homepage  >> Scribble Web  >> Figure out user login name in registry HKU is hosted by Perceptus Solutions Inc.