'Lists all the user accounts and their corresponding SIDs.
'Copyright © 2005 Ramesh Srinivasan
'Created on: August 10, 2005
'Operating System: Tested in Windows XP only
'Homepage: http://windowsxp.mvps.org

Set wshshell = CreateObject("Wscript.Shell")
Set fso = Wscript.CreateObject("Scripting.FilesystemObject")
fName = WshShell.SpecialFolders("Desktop")
fName = fName & "\SID.txt"
set b = fso.CreateTextFile(fName, true)
b.writeline "Lista de cuentas de usuario y sus SIDs"
b.writeline string(44,"~")
b.writeblanklines 1

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAccounts = objWMIService.ExecQuery _
    ("Select * From Win32_UserAccount")

For Each objAccount in colAccounts

	If objAccount.Name = "HelpAssistant" or objAccount.Name = "SUPPORT_388945a0" then
	else

		b.writeline "Username   : " & objAccount.Name
		b.writeline "SID        : " & objAccount.SID
		b.writeblanklines 1
	end if
Next

b.writeline string(44,"~")
b.close
WshShell.Run "notepad.exe " & fName, 1,True

Set fso = Nothing
set Wshshell = Nothing
