'**************************************** '**************************************** ' Group Search ' Version 0.4b ' June 2004 ' Willem VanEssendelft ' wilATdingofenceDOTcom ' ' This script is provided as is. ' use at your own risk. ' ' Please report any bugs or ' comments. ' ' It has only been tested on a ' small domain. It probably needs ' to be run from an XP box to ' work on an NT domain. ' '------------------------------- ' ' Description: ' This script will report all the ' groups in a domain and their ' members. A .csv file is created ' in the %temp% of the local machine. ' The output file is overwritten each ' time the script is run. ' '**************************************** '**************************************** Option Explicit Dim WshShell, oFile, oResults, oDomain, oGroup, oMembers, oAccount Dim strTempPath, strOutFile, strDomainName, strTargetDomain, strOut Dim q Set WshShell = WScript.CreateObject("WScript.Shell") Set oFile = CreateObject("Scripting.FileSystemObject") strTempPath = WshShell.ExpandEnvironmentStrings("%temp%") strOutFile = strTempPath & "\GroupMembers.csv" Set oResults = oFile.OpenTextFile(strOutFile,2,True) strDomainName = Inputbox("Enter Domain Name","SearchGroups Version 0.4b","NetBIOS Name") strTargetDomain = "WinNT://" & strDomainName If strDomainName = "" Then wscript.echo "No Domain entered. Process Cancelled" Wscript.quit End If Set oDomain = GetObject(strTargetDomain) oDomain.Filter = Array("Group") For Each oGroup In oDomain strOut = oGroup.Name Set oMembers = oGroup.Members For Each oAccount In oMembers strOut = strOut & "," & oAccount.Name ' & "(" & oAccount.Class & ")" Next q = oResults.Writeline(strOut) strOut = " " Next 'Cleanup Set oFile = Nothing Set oResults = Nothing Set oMembers = Nothing 'Exit Wscript.echo "Extract complete" & vbCR & "Output file at " & strOutFile wscript.quit