+ Reply to Thread
Results 1 to 17 of 17

Pull Active Directory Group Information into Excel

Hybrid View

  1. #1
    Registered User
    Join Date
    06-10-2009
    Location
    Indiana, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Pull Active Directory Group Information into Excel

    Quote Originally Posted by romperstomper View Post
    So are those your user ids for logging into the network?
    Correct. Those are user login id's.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: Pull Active Directory Group Information into Excel

    See if this function works for you:
    Function GetGroupUsers(strGroupName As String) As String
    
        Dim objGroup, objDomain, objMember
        Dim strMemberList As String, strDomain As String
        
        Set objDomain = GetObject("LDAP://rootDse")
        strDomain = objDomain.Get("dnsHostName")
        
        Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroupName & ",group")
        
        For Each objMember In objGroup.Members
            strMemberList = strMemberList & objMember.Name & vbCrLf
        Next objMember
        
        GetGroupUsers = strMemberList
    
    End Function
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    06-10-2009
    Location
    Indiana, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Pull Active Directory Group Information into Excel

    Quote Originally Posted by romperstomper View Post
    See if this function works for you:
    Function GetGroupUsers(strGroupName As String) As String
    
        Dim objGroup, objDomain, objMember
        Dim strMemberList As String, strDomain As String
        
        Set objDomain = GetObject("LDAP://rootDse")
        strDomain = objDomain.Get("dnsHostName")
        
        Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroupName & ",group")
        
        For Each objMember In objGroup.Members
            strMemberList = strMemberList & objMember.Name & vbCrLf
        Next objMember
        
        GetGroupUsers = strMemberList
    
    End Function
    Ok, I thought I knew what I was doing but I don't. How do I get this code into the worksheet? I tried pasting it once I clicked on the visual basic link but could never get it to work. I appreciate all the help!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1