Enumerate AD and list users and group membership

Author Message
wills.jason

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 5/23/2006
  • Status: offline
Enumerate AD and list users and group membership Tuesday, January 31, 2012 9:45 PM (permalink)
0
Hi All,
 
there are many vbscripts out there that so nearly do what i want it to do, however i have been unsuccessful in trying to merge some.
so i thought i'd ask here:
 
i am trying to go through AD and export to a csv file a list of users and their group membership.
so the csv should look like:
 
Username1, group1, group2,group3
Username2, group2,group3,
Username3, group1, group3
 
Hope i have explained myself ok, and thankyou in advance for any help on this.
 
Regards
 
jason
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: online
    Re:Enumerate AD and list users and group membership Wednesday, February 01, 2012 2:09 AM (permalink)
    0
    The first step is to show us what you have written and in what specific way it is not working. Then we can help you straighten it out.
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      TaterTot

      • Total Posts : 33
      • Scores: 0
      • Reward points : 0
      • Joined: 7/26/2010
      • Status: offline
      Re:Enumerate AD and list users and group membership Wednesday, February 01, 2012 3:59 AM (permalink)
      0
      This should get you started... Replace MYDOMAIN with whatever you domain is named. 
       
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set DomainName= GetObject("[link=ldap://DC=MYDOMAIN,DC=com]LDAP://DC=MYDOMAIN,DC=com[/link]")
       
      Const ForWriting = 2
      CollectionString = ""
      LogFile = "LogFile.Log"
       
      If (objFSO.FileExists(LogFile)) = False Then
       objFSO.CreateTextFile(LogFile)
      End If
       
      ReadAD(DomainName)
       
      Sub ReadAD(ThisObject)
       CollectionString = CollectionString & ThisObject.Name & vbCrLf
       For each objChild in ThisObject
        ReadAD(objChild)
       Next
      End Sub
       
      Set TextEditor = objFSO.OpenTextFile(LogFile, ForWriting)
      TextEditor.WriteLine CollectionString
      TextEditor.Close
      <message edited by TaterTot on Wednesday, February 01, 2012 4:16 AM>
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9