ESSIMANDT
asked on
Users & Group members of AD Groups
I am trying to find a VBS Script that displays or exports to a text \ excel file the users & groups which are members of an ad group or groups in an OU.
GroupA - List of Users
Group - List of Users
GroupB - List of Users
Group - List of Users
GroupA - List of Users
Group - List of Users
GroupB - List of Users
Group - List of Users
If groups contains user and groups i think the pipe dsget group will return an error, unless you specify the -c switch to continue if error occurs.
An alternative could be to use this syntax
dsquery * -limit 0 -filter "(&(memberof:1.2.840.11355 6.1.4.1941 :=CN=mygro up,DC=doma in,DC=com) )" -attr samaccountname cn > membersofmygroup.txt
Else you can use VBS: you can find examples here:
http://www.rlmueller.net/MemberOf.htm
An alternative could be to use this syntax
dsquery * -limit 0 -filter "(&(memberof:1.2.840.11355
Else you can use VBS: you can find examples here:
http://www.rlmueller.net/MemberOf.htm
Nope, because of -expand switch :) It gets also users from sub groups (if exists within queried group)
Krzysztof
Krzysztof
Personnaly on a group containing users and others groups, your command works if i write:
dsquery group -name "w2k migrated users" | dsget group -members -expand | dsget user -fn -ln -samid -c
but for each group in the current group requested, i get errors. It's not really an issue and you're right, but the log file isn't very clear.
with mine it's maybe a quite longer but no error occurs.
dsquery group -name "w2k migrated users" | dsget group -members -expand | dsget user -fn -ln -samid -c
but for each group in the current group requested, i get errors. It's not really an issue and you're right, but the log file isn't very clear.
with mine it's maybe a quite longer but no error occurs.
Here is a vbs that writes members of all the groups, or all groups in an OU if you specify to Excel.
http://adfordummiez.com/?p=129
http://adfordummiez.com/?p=129
ASKER
The VBS script works but does not give you the members of the group within a group.
I want to be able to display or export the users & groups of an AD group.
dsget does not display the name of the group within a group, it just displays all member users.
I want to be able to display or export the users & groups of an AD group.
dsget does not display the name of the group within a group, it just displays all member users.
It don't display members of nested groups on the same sheet as the "parent" group. You will just see its group name, and there will be a new sheet for that group.
Use PowerShell for that and try accepted answer from KenMcF in this EE post
https://www.experts-exchange.com/questions/26809078/powershell-script-to-export-all-memeber-of-domain-administrator-group.html
Krzysztof
https://www.experts-exchange.com/questions/26809078/powershell-script-to-export-all-memeber-of-domain-administrator-group.html
Krzysztof
ASKER
I tried the VBS script on a parent group which had a nested group, but there was no output for the nested group.
It will create the nested group in a new sheet.
i.e.
-------------------------- ---------- -------
Group A members (sheet #1):
Bob Doe
John Wayne
Group_B
Jermain Defoe
Count: 4
-------------------------- ---------- -------
Group_B members (sheet #2):
Harry Redknapp
Count: 1
i.e.
--------------------------
Group A members (sheet #1):
Bob Doe
John Wayne
Group_B
Jermain Defoe
Count: 4
--------------------------
Group_B members (sheet #2):
Harry Redknapp
Count: 1
ASKER
I understand waht you are saying, but it does not create a new tab for the nested group.
i.e.
-------------------------- ---------- -------
Group A members (sheet #1):
Bob Doe
John Wayne
Group_B
Jermain Defoe
Count: 4
-------------------------- ---------- -------
Group_B members (sheet #2): This part does not happen for Group_B
Harry Redknapp
Count: 1
i.e.
--------------------------
Group A members (sheet #1):
Bob Doe
John Wayne
Group_B
Jermain Defoe
Count: 4
--------------------------
Group_B members (sheet #2): This part does not happen for Group_B
Harry Redknapp
Count: 1
hmm weird. I tested that just before posting.
I'll guess you can see it better from where you are that I'm able to :)
I'll guess you can see it better from where you are that I'm able to :)
ASKER
My question is in 1 Zone(s).
My question has 12 Total comment(s).
My reason is: I need a VBS or any other script that will list or export all AD users of a group & nested groups.
Group A
Users
Nested Group A
Users
Nested Group B
Users
My question has 12 Total comment(s).
My reason is: I need a VBS or any other script that will list or export all AD users of a group & nested groups.
Group A
Users
Nested Group A
Users
Nested Group B
Users
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
tHANK yOU
dsquery group -name "DNSGroupName" | dsget group -members -expand | dsget user -fn -ln -samid >>c:\members.txt
or if you wish you can use Quest PowerShell cmdlets.
Regards,
Krzysztof