DSQuery Help!

  • Follow


This is my syntax. I'm trying to read all members of a group.
dsquery * dc=mydomain,dc=lab -filter 
"(&(objectCategory=group)(name=myGroup))" -attr displayName member
With this I have managed to read the groups but it brings the results out in 
its fully distinguished Name. Is there a way I can probably just get the 
name to display similar to if I had done for example
dsquery user -name Nik* -o rdn
Thanks
Nik 

0
Reply Nik 2/4/2010 6:05:18 PM

Sorry about that
dsquery * dc=mydomain,dc=lab -filter 
(&(objectCategory=group)(name=*))"  -attr displayName member
I wish for the members display name to show just as the groups display names 
are show instead of the DN



"Nik" <nalleyne@maxxam.lab> wrote in message 
news:OkKVxRcpKHA.1548@TK2MSFTNGP04.phx.gbl...
> This is my syntax. I'm trying to read all members of a group.
> dsquery * dc=mydomain,dc=lab -filter 
> "(&(objectCategory=group)(name=myGroup))" -attr displayName member
> With this I have managed to read the groups but it brings the results out 
> in its fully distinguished Name. Is there a way I can probably just get 
> the name to display similar to if I had done for example
> dsquery user -name Nik* -o rdn
> Thanks
> Nik 

0
Reply Nik 2/4/2010 6:50:51 PM


Here is how I do it. My group name is engineering.

dsquery group -name engineering|dsget group -members|dsget user -samid -fn -ln

"Nik" wrote:

> This is my syntax. I'm trying to read all members of a group.
> dsquery * dc=mydomain,dc=lab -filter 
> "(&(objectCategory=group)(name=myGroup))" -attr displayName member
> With this I have managed to read the groups but it brings the results out in 
> its fully distinguished Name. Is there a way I can probably just get the 
> name to display similar to if I had done for example
> dsquery user -name Nik* -o rdn
> Thanks
> Nik 
> 
> .
> 
0
Reply Utf 2/4/2010 9:56:07 PM

The objectClass group stores membership under a mutli-value attribute called 
member, which is stored as the distinguished name of the user account or 
group. 

A query of all available attributes shows that the sAMAccountName or display 
name is not being stored as an attribute within the group objectClass. So 
there would not be a single query filter that could be issued against the 
group objectClass to get this information. 

dsquery * dc=mydomain,dc=lab -filter "(&(objectCategory=group)(name=Domain 
Admins))" -attr *

tkutil's way is a good method of getting the information though!

"Nik" wrote:

> This is my syntax. I'm trying to read all members of a group.
> dsquery * dc=mydomain,dc=lab -filter 
> "(&(objectCategory=group)(name=myGroup))" -attr displayName member
> With this I have managed to read the groups but it brings the results out in 
> its fully distinguished Name. Is there a way I can probably just get the 
> name to display similar to if I had done for example
> dsquery user -name Nik* -o rdn
> Thanks
> Nik 
> 
> .
> 
0
Reply Utf 2/5/2010 3:06:06 PM

Eric: thanks for clearing the air on that one at least I have a better 
understanding of the query now.
Tkutil: I have used your method before to get the information when I 
explicitly specify the group name
Thanks for the help guys

"Eric Westfall" <EricWestfall@discussions.microsoft.com> wrote in message 
news:EABC6895-C63D-4C23-8AEB-215EB26EF07E@microsoft.com...
> The objectClass group stores membership under a mutli-value attribute 
> called
> member, which is stored as the distinguished name of the user account or
> group.
>
> A query of all available attributes shows that the sAMAccountName or 
> display
> name is not being stored as an attribute within the group objectClass. So
> there would not be a single query filter that could be issued against the
> group objectClass to get this information.
>
> dsquery * dc=mydomain,dc=lab -filter "(&(objectCategory=group)(name=Domain
> Admins))" -attr *
>
> tkutil's way is a good method of getting the information though!
>
> "Nik" wrote:
>
>> This is my syntax. I'm trying to read all members of a group.
>> dsquery * dc=mydomain,dc=lab -filter
>> "(&(objectCategory=group)(name=myGroup))" -attr displayName member
>> With this I have managed to read the groups but it brings the results out 
>> in
>> its fully distinguished Name. Is there a way I can probably just get the
>> name to display similar to if I had done for example
>> dsquery user -name Nik* -o rdn
>> Thanks
>> Nik
>>
>> .
>> 
0
Reply Nik 2/5/2010 7:43:28 PM

4 Replies
432 Views

(page loaded in 0.105 seconds)


Reply: