Hello,
Im trying to make a list of members of a Group in AD. I can do it so it returns the result from one group but I have about 50 groups. Is there a way of getting a script to get all the groups from one OU and list the Group name and its members?
Eg. GROUPS->BUILDERS->REGIONA->House1,House 2,House 3
I need it to look in the Builders OU then list Region A then all the groups in Region A and all the members of House 1.
This is the current script I have.
Im trying to make a list of members of a Group in AD. I can do it so it returns the result from one group but I have about 50 groups. Is there a way of getting a script to get all the groups from one OU and list the Group name and its members?
Eg. GROUPS->BUILDERS->REGIONA->House1,House 2,House 3
I need it to look in the Builders OU then list Region A then all the groups in Region A and all the members of House 1.
This is the current script I have.
Code:
'-------------------------------
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
Const ForAppending = 8
strGroup = InputBox("Enter group name")
strGroup= "domain\" & strGroup
strFile = InputBox("Enter output file")
Set objFSO = CreateObject("Scripting.FilesystemObject")
Set objFile = objFSO.OpenTextFile(strFile, ForAppending, True)
Set objTrans = CreateObject("NameTranslate")
objTrans.Set ADS_NAME_TYPE_NT4, strGroup
strGroupDN = objTrans.Get(ADS_NAME_TYPE_1779)
Set objGroup = GetObject ("LDAP://" & strGroupDN)
objGroup.GetInfo
arrMemberOf = objGroup.GetEx("member")
For Each strMember in arrMemberOf
Set objUser = GetObject ("LDAP://" & strMember)
objUser.GetInfo
objFile.writeline objUser.DisplayName
Next
objFile.close
Set objFile = Nothing
Set objFSO = nothing
'-------------------------------
Last edited: