VB Scripting - Input username, return SID
Posted on 2003-03-10
I am developing a C2/CC Security Policy template that will be deployed to many different Organizations/Domains. Some services and registry keys require a user account to have rights, so I can't just go with the well-known SIDS, I need to find a way to get the user's sid into the INF file.
This is what I've got so far (I just started to teach myself scripting last week):
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
UserName1 = InputBox("Enter the account name of the Exchange Service account. The default is exchangeservice:","Input Box","exchangeservice")
set User = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_UserAccount",,48)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("c:\testfile.txt", True)
For Each objItem in colItems
objFile.WriteLine "Name: " & objItem.Name
objFile.WriteLine "SID: " & objItem.SID
This will write the Names and SIDS of all users. How do I use an InputBox to specify a user and write that SID to a file?
I appreciate any help on this.