At the following technet location they show a script that retrievs the SID with a username and domain.
http: //blogs.technet.com/b/heyscriptingguy/archive/2004/12/03/how-can-i-determine-the-sid-for-a-user-account.aspx
They also have the following script to get the username and domain from a SID:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objAccount = objWMIService.Get _
("Win32_SID.SID='S-1-5-21-1454471165-1004336348-1606980848-5555'")
Wscript.Echo objAccount.AccountName
Wscript.Echo objAccount.ReferencedDomainName
Instead of the SID I want to put a variable from standard input to retrieve the Accountnameand Domainname.
I have made the other changes to the script I want, and it functions with
("Win32_SID.SID='S-1-5-21-1454471165-1004336348-1606980848-5555'")
but I want to change the SID to a variable.
For lack of another way to put it:
("Win32_SID.SID='input variable'")
When I replace that in my script I get:
(10, 5) Microsoft VBScript compilation error: Expected statement
Can you tell me how to put a varible into that line?