» Determine SID of Windows user

On twitter

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

 

Stay up to date

You can track my blog rss articles and rss comments. You may also find my rss bookmarks interesting. Or twitter Follow me on Twitter


Like this Article?

Your money is no good here, but
you can boost morale by spreading the word! : )


tags: windows, security, SID, VBScript
category: Howto - Windows
read: 21,074 times

Add Comment

Comments have been automatically closed because of the age of the article. If you need to, you can still contact me on the subject.

Comments

#5. Calvin Kwok on 16 July 2010

Gravatar.com: Calvin KwokReally helpful script! Thank you Kevin!

#4. Kevin on 17 September 2009

Twitter.com: kvz@ calanan & Adam: Thanks for sharing

#3. calanan on 08 September 2009

Gravatar.com: calananGreat tip, just what I was looking for. Thanks.

p.s. Works on XP SP3

#2. Adam on 30 December 2008

Gravatar.com: AdamThanks Kevin - worked fine on 2k3.

#1. Marcelo on 27 March 2008

Default avatar:MarceloVery interesting