' Name: determine-sid ' Version: 1.0 ' Description: Determine the Security Identifier (SID) associated with an account by ' providing the userid for the account ' Written By: Jim Cameron based on information provided at ' http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec04/hey1203.mspx ' Date Created: 2009-08-11 ' Lasat modified: 2009-08-11 ' Download from: http://support.moonpoint.com/downloads/computer_languages/VBScript/determine_sid.vbs ' Usage: From a command line run "cscript determine-sid.vbs Userid ' ComputerName_or_DomainName" where "Userid" is the userid for which you wish ' to see the SID and "ComputerName_or_DomainName" is the name for the computer, ' if you are checking on a local account on the computer or the domain name, if ' the computer is in a domain and you are checking for the SID for a domain ' account. If you don't enter the "Userid" and "ComputerName_or_DomainName" ' information at the command prompt, e.g. you just enter ' "cscript determine_sid.vbs", you will be prompted for that information. ' ' Note: You must run the script from an account with administrator privileges ' Otherwise you will receive a "SWbemServicesEx: Not found" error message. strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") If Wscript.Arguments.Count < 2 Then strUserid = InputBox("Userid: ") strDomain = InputBox("Computer Name or Domain: ") Else strUserid = Wscript.Arguments(0) strDomain = Wscript.Arguments(1) End If Set objAccount = objWMIService.Get("Win32_UserAccount.Name='"+strUserid+"',Domain='"+strDomain+"'") Wscript.Echo "Userid: " & strUserid Wscript.Echo "Computer Name/Domain: " & strDomain Wscript.Echo "SID: " & objAccount.SID