Solved

DSQuery weirdness

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

Installing a printer using group policy preferences is not that hard let’s take a look at it. First lets open up your group policy console and edit the policy you want to add it to. I recommend creating a new policy for each printer makes it a l…
Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

895 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

18 Experts available now in Live!

Get 1:1 Help Now