![]() |
|
|
|
|
|
|
5
30th October 07:47
External User
Posts: 1
|
First, you may be able to use Joe Richards' free adfind utility for this:
http://www.joeware.net/freetools/tools/adfind/index.htm This still has the drawback that people that use it need the tool, but at least it's one exe. PowerShell requires .NET framework, PowerShell, and the cmdlets. Next, I just noticed you used -expand to reveal nested group members. In VBScript we can do the same thing with a recursive subroutine: ======= Option Explicit Dim objGroup Dim strExcelPath, objExcel, objSheet, intRow ' Spreadsheet file to be created. strExcelPath = "c:\scripts\Computers.xls" ' Bind to Excel object. Set objExcel = CreateObject("Excel.Application") ' Create a new workbook. objExcel.Workbooks.Add ' Bind to worksheet. Set objSheet = objExcel.ActiveWorkbook.Worksheets(1) ' Bind to the group object. Set objGroup = GetObject("LDAP://cn=AdobeAcrobat9,ou=*,ou=Groups,ou=*,DC=*,DC=*") ' Enumerate members. intRow = 1 Call GetMembers(objGroup) objExcel.ActiveWorkbook.SaveAs strExcelPath objExcel.ActiveWorkbook.Close Sub GetMembers(objParent) ' Recursive subroutine to enumerate nested group membership. ' objSheet and intRow must have global scope. Dim objParent, strName For Each objMember In objParent.Members If (objMember.Class = "computer") Then ' Retrieve NetBIOS name of computer. strName = objMember.sAMAccountName ' Strip off trailing "$" strName = Left(strName, Len(strName) - 1) objSheet.Cells(intRow, 1).Value = strName objSheet.Cells(intRow, 2).Value = objMember.description intRow = intRow + 1 End If If (objMember.Class = "group") Then Call GetMembers(objMember) End If Next End Sub -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
|