This Vbs script will prompt you for a domain name and then list all of the members of the “SMS Reporting Users” group by login name and full name in an excel spreadsheet.
Note: The script can also be modified to list the members of a group other than the SMS Reporting Users by changing the strGroup to the group that you want to enumerate. For example if you want to list all of the members of the SMS Admins group add the value “SMS Admins” in place of the “SMS Reporting Users”.
Vbs Script:
strDomain = InputBox ("Enter Domain Name")
strGroup = "SMS Reporting Users"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Domain Name"
objExcel.Cells(1, 2).Value = "Group Name"
objExcel.Cells(1, 3).Value = "Login Name"
objExcel.Cells(1, 4).Value = "Full Name"
Set Group = GetObject("WinNT://" & strDomain & "/" & strGroup & ",Group")
For Each Member in Group.Members
objExcel.Cells(intRow, 1).Value = UCase(strDomain)
objExcel.Cells(intRow, 2).Value = strGroup
objExcel.Cells(intRow, 3).Value = Member.Name
objExcel.Cells(intRow, 4).Value = Member.FullName
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
Wscript.Echo "Done"
No Comments