Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Using standard input in this vbs script

$
0
0

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?

 


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>