This VBS script will allow you to send the members of a hard coded NT or Active Directory (AD) domain to an excel spreadsheet.
VBS Script:
strDomain = InputBox ("Enter Domain Name")
strGroup = "GroupName"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "User Name"
Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroup)
Set strMembers = objGroup.Members
For Each strMember In strMembers
objExcel.Cells(intRow, 1).Value = strMember.Name
intRow = intRow + 1
Next
objExcel.Range("A1").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