none
Script lists group members full path in AD, but how can I get it to give me first & last names also RRS feed

  • Question

  • I have the following script, but I'm stuck, wondering if anyone can help me out.  Currently the script writes a csv file where it lists all members of a group, but it lists them as CN=TheirUsername,OU=blabla.   Is there a way to have it list that and then pull the first and last name from the individual AD accounts, or just have it list only their first and last name and not the full AD path stuff?

    On Error Resume Next
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set outfile = fso.CreateTextFile("Members.csv")
    Set objGroup = GetObject("LDAP://CN=MyGroupName,OU=MyOU,DC=domain,DC=com")
    objGroup.GetInfo

    arrMembersOf = objGroup.GetEx("member")

    For Each GetObject in ObjGroup
        outfile.WriteLine objGroup.Name
    Next

    For Each strMember in arrMembersOf
        outfile.WriteLine strMember
    Next

    Tuesday, April 28, 2015 5:57 PM

Answers

All replies