Find Users SID

By | September 28, 2006

I was looking through the registry of a terminal server for a users outlook profille info.
The only problem was, all users are referred to by an SID.
I did some searching on the Internet and found this answer.
This script will allow you to pull a users SID and display it in a message box.

———-COPY EVERYTHING BELOW THIS LINE———-

'This script will allow you to pull a users SID and display it in a message box.
'Created by C.E. Harden September 28 2006

sUser = InputBox("Type in the name of the user you want to query.")
sDomain = "matrixsvr"

Set oUserAccount = GetObject("winmgmts://./root/cimv2") _
    .Get("Win32_UserAccount.Domain='" & sDomain & "'" _
    & ",Name='" & sUser & "'")

sUserSID = oUserAccount.SID
WScript.Echo sUser & "'s" &" SID: " & sUserSID

———-COPY EVERYTHING ABOVE THIS LINE———-

PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR SCRIPT!!!

To make this script work you will need two things!

1. You will need the users login name.
2. You will need to be an Admin.

This information is provided "AS IS" with no warranties expressed or implied.

Leave a Reply

Your email address will not be published. Required fields are marked *