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

http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec04/hey1203.mspx

--- 


I couldn't get the above to work - missing a library or something; however the code in this thread worked well:
http://groups.google.com/group/microsoft.public.windows.server.scripting/browse_thread/thread/49ab074d46eee0ef/83b5a306de01a113?lnk=st&q=get+user+sid&rnum=1#83b5a306de01a113

 

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
    Author:
    leonard
    Date Updated:
    2016-04-17 18:11:21
    Date Created:
    2006-04-27 12:10:26

    Edit

    Comments?
     >> Leonard Chan's Homepage  >> Scribble Web  >> Figure out user login name in registry HKU
    leonard.lotus-land.ca is hosted by Perceptus Solutions Inc.