News:

Ryan's Free Online Tech Forum
redux.

Main Menu

Get SID of a user

Started by scythe944, August 13, 2020, 11:36:13 AM

Previous topic - Next topic

scythe944

Just fill in "username" and "domainname" fields, then save as vbs and run.


strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set objAccount = objWMIService.Get _
    ("Win32_UserAccount.Name='username',Domain='domainname'")
Wscript.Echo objAccount.SID

scythe944

Or use dsquery:

dsquery user domainroot -name username |dsget user -sid

If you want the results in a text just add "> path to file"  like so:

dsquery user domainroot -name username |dsget user -sid >c:\usersid.txt