Solved

DSQuery weirdness

Posted on 2010-11-10
4
721 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 83

Accepted Solution

by:
oBdA earned 500 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Learn about cloud computing and its benefits for small business owners.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now