Extracting users from a Group


G

Guest

Hi,

I'm trying to list the users in a AD Security group. This is the result I get:

C:\Documents and Settings\Administrator>dsquery group "cn=TSP All
Users,ou=Domain Groups,dc=win,dc=ece,dc=mcgill,dc=ca"
"CN=TSP All Users,OU=Domain Groups,DC=win,DC=ece,DC=mcgill,DC=ca"

I seem to be able to list the group and not the users whithin the group.

How do I go about listing the users IN the group?

TIA, Ben
 
Ad

Advertisements

M

Matjaz Ladava [MVP]

Two options:

1. If you know the DN of a group, you can directly use dsget group
groupDN -members
2. If you are doing dsquery, then you can pipeline your dsquery output to
dsget like
C:\Documents and Settings\Administrator>dsquery group "cn=TSP All
Users,ou=Domain Groups,dc=win,dc=ece,dc=mcgill,dc=ca" | dsget group -members

--
Regards

Matjaz Ladava, ladava.com
MCSA, MCSE, MCT
Microsoft MVP Windows Server - Directory Services
e-mail: (e-mail address removed), (e-mail address removed)
 
J

Jerold Schulman

Hi,

I'm trying to list the users in a AD Security group. This is the result I get:

C:\Documents and Settings\Administrator>dsquery group "cn=TSP All
Users,ou=Domain Groups,dc=win,dc=ece,dc=mcgill,dc=ca"
"CN=TSP All Users,OU=Domain Groups,DC=win,DC=ece,DC=mcgill,DC=ca"

I seem to be able to list the group and not the users whithin the group.

How do I go about listing the users IN the group?

TIA, Ben
dsget group "CN=TSP All Users,OU=Domain Groups,DC=win,DC=ece,DC=mcgill,DC=ca" -members
or
dsget group "CN=TSP All Users,OU=Domain Groups,DC=win,DC=ece,DC=mcgill,DC=ca" -members -expand



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 
G

Guest

Hi guys,

Thanks a lot for all your input. I tried all 3 sugesstions and they all work
great! I'm sure I'll use them in the future quite a bit.

Cheers, Ben
 
Joined
May 11, 2010
Messages
1
Reaction score
0
Hello,
I am using this script:
http://www.microsoft.com/technet/sc...s/adgpvb13.mspx

but I have several groups and I don't want the CN=, OU=WHATEVER,DC=THIS,DC=COM
on my output. I just want a listing of the group name and the users in the group(s).
My groups all start the same: PAYroll, PAYrolltime, PAYadmins, etc...

Any suggestions?
Thanks
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top