- Published on
Determine SID of Windows User
- Authors

- Name
- Kevin van Zonneveld
- @kvz
Sometimes when digging real deep into Windows like I recently had to, you need to have the Windows SID (Security Identifier) of a local user. I wasn't able to find any standard way of obtaining this info, so I wrote this little VBScript. Might help some people, might not. Putting this online anyway ; )
Open notepad and paste the following script:
strComputer = "`<COMPUTERNAME>`"
strUser = "`<USERNAME>`"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objAccount = objWMIService.Get ("Win32_UserAccount.Name='" & strUser & "',Domain='" & strComputer & "'")
Wscript.Echo objAccount.SID
Obviously,
- Change the
<COMPUTERNAME>and<USERNAME> - Save with .vbs extension (Like getsid.vbs)
- Execute it
Legacy Comments (5)
These comments were imported from the previous blog system (Disqus).
Marcelo·
Very interesting
Adam·
Thanks Kevin - worked fine on 2k3.
calanan·
Great tip, just what I was looking for. Thanks.
p.s. Works on XP SP3
Kev van Zonneveld·
@ calanan & Adam: Thanks for sharing
Calvin Kwok·
Really helpful script! Thank you Kevin!