This VBS script will allow you to enter a Domain Controller (DC) Server name or a remote workstation name to list the SIDS
DnsAdmins
S-1-5-21-1808774407-1002908778-2105408048-1101
Local
LabServer
Domain
LabDomain
VBS Script:
strComputer = InputBox ("Enter Server Name")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Name"
objExcel.Cells(1, 2).Value = "SID"
objExcel.Cells(1, 3).Value = "Type"
objExcel.Cells(1, 4).Value = "Domain"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Account")
For Each objItem in colItems
objExcel.Cells(intRow, 1).Value = objItem.Name
objExcel.Cells(intRow, 2).Value = objItem.SID
If objItem.LocalAccount = TRUE Then
objExcel.Cells(intRow, 3).Value = "Local"
ElseIf objItem.LocalAccount = FALSE Then
objExcel.Cells(intRow, 3).Value = "Domain"
End If
objExcel.Cells(intRow, 4).Value = objItem.Domain
intRow = intRow + 1
Next
objExcel.Range("A1:D1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set objRange = objExcel.Range("A1")
objRange.Sort objRange,1,,,,,,1
MsgBox "Done"
No Comments