' ------------------------------------------------------------------------- ' From the book Inside Active Directory, ISBN 0-201-61621-1 ' Copyright (C) 2002 by Addison-Wesley ' Script by Sakari Kouti (see http://www.kouti.com) ' You have a royalty-free right to use, modify, reproduce and distribute ' this script (and/or any modified version) in any way you find useful, ' provided that you agree that Addison-Wesley or Sakari Kouti has no ' warranty, obligations or liability for the script. If you modify ' the script, you must retain this copyright notice. ' ------------------------------------------------------------------------- Option Explicit Dim strDN, objExcel, objContainer, objChild strDN = InputBox("Enter the distinguished name of a container") Set objExcel = WScript.CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add objExcel.ActiveSheet.Name = "Users of " & Left(strDN,19) & "..." objExcel.ActiveSheet.Range("A1").Activate objExcel.ActiveCell.Value = "Name" 'col header 1 objExcel.ActiveCell.Offset(0,1).Value = "Description" 'col header 2 objExcel.ActiveCell.Offset(1,0).Activate 'move 1 down Set objContainer = GetObject("LDAP://" & strDN) objContainer.Filter = Array("user") For Each objChild In objContainer objExcel.ActiveCell.Value = objChild.Name objExcel.ActiveCell.Offset(0,1).Value = objChild.Description objExcel.ActiveCell.Offset(1,0).Activate 'move 1 down Next