Jump to content

VB Script - Users of Membership to *.csv

- - - - -

  • Please log in to reply
No replies to this topic

#1
rk0r

rk0r

    Newbie

  • Members
  • PipPip
  • 20 posts
Hi

I work with Active directory everyday with a user base of just over 12000, I sometimes get asked to produce a list of users that belong to a membership group. Unfortunately the tools I use to not have this functionality to produce an *.csv file for the end user to review, it’s all down to the security restrictions and testing of 3rd party software to be safe on the network. So to by-pass this I have to run a VBscript to extract the data, I thought I would share this code with you... Maybe it can improve or be utilised or just for the knowledge of doing it.


---------------------------------------------------------------------------------------------------

On Error Resume Next
Set fso = CreateObject("scripting.FilesystemObject)
Set outfile = fso.CreateTextFile("yournamehere.csv)
Set objGroup = GetObject _
("LDAP://CN=YOUGROUPNAMEHERE ,OU=Groups, OU=AGENCY, DC=AGENCY, DC=local")
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



----------------------------------------------------------------------------------




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users