Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DSQuery weirdness

Posted on 2010-11-10
4
Medium Priority
?
748 Views
Last Modified: 2012-05-10
When I try to get all the members in the domains admin group. I have 5 users in the domain admins group. When I do a query using dsquery it only shows me 2. Yet active directory users and computers show 5. it only seems to do this with the domain admins group and NOT with other groups. I need it to show all users in that group. any suggestions?


dsquery group -name "Domain Admins" | dsget group -members | dsget user -fn -mi -ln
0
Comment
Question by:Delmiroc
  • 2
4 Comments
 
LVL 5

Expert Comment

by:daveTechSearch
ID: 34107020
I'm guessing that you're only getting output from accounts that have the fields you are requesting populated with data.  What happens when you also request '-dn' with 'dsget user'?
0
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 total points
ID: 34107460
Check the properties of the three "missing" users; they've probably had their primary group membership changed from Domain Users to Domain Admins. A user's primary group membership will not be returned.
Change that back to "Domain Users"; the primary group has no importance in an AD domain, there's absolutely no use in changing this to "Domain Admins".
0
 
LVL 5

Expert Comment

by:daveTechSearch
ID: 34107564
I'm pretty confident with my suggestion above.
For instance, if I run this in our environment:
dsquery group -name "Domain Admins" | dsget group -members | dsget user -mi

that is, only requesting '-mi', I won't get any results. We don't populate it.
If I run:
dsquery group -name "Domain Admins" | dsget group -members | dsget user -fn -mi -ln
I get *some* results.  Not all created accounts were populated with FirstName,MiddleName,or LastName. Only the accounts that have at least *one* of the fields populated will show in the results.
If I run:
dsquery group -name "Domain Admins" | dsget group -members | dsget user -fn -mi -ln -dn
That is, include '-dn' I get a listing of all group members (Some of the requested fields will be blank, as they have not been populated with info/data).
0
 
LVL 1

Author Closing Comment

by:Delmiroc
ID: 34107793
Thank you guys.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question