Dim fso
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set f = fso.OpenTextFile("C:\Users\Administrator\Desktop\sid\output.txt", 2)
Set objNet = CreateObject("WScript.Network")
strComputer = objNet.ComputerName
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAccounts = objWMIService.ExecQuery _
("Select * From Win32_UserAccount Where Domain = '" & strComputer & "'")
For Each objAccount in colAccounts
If Left (objAccount.SID, 6) = "S-1-5-" and Right(objAccount.SID, 4) = "-500" Then
f.WriteLine objAccount.Name
f.WriteLine objAccount.SID
f.WriteLine "Computer's SID: " & Left(objAccount.SID, Len(objAccount.SID) - 4)
End If
Next
f.Close