Solved

DSQuery weirdness

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
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…
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 …

778 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