Using Saved Queries, personalizing ADUC

Saved queries have been one of the overlooked features in the admins toolbox.


You can save queries to search for disabled user or computer accounts, number of days since the last user logon, users with non-expiring Passwords, and many other commonly used queries. All queries located in the Saved Queries folder are stored in Active Directory Users and Computers (dsa.msc). Once you have successfully created your customized set of queries you can copy the .msc file to other domain controllers (located in the same domain) and use the same set of saved queries. You can also export saved queries to an .xml file and import them into other Active Directory User and Computer consoles located on domain controllers (within the same domain).

To get started go to Active Directory Users and Computers:

Right click the Saved Queries folder and select New, Query.
Enter an appropriate Name and Description.
Make sure the query root is set to the domain level you want the query to pertain to.
Select the Include sub-containers check box if you want the query to search all sub-containers.
Click Define Query.
In the Find dialog box, click the Find drop-down arrow and select Custom Search.
On the Advanced tab, enter your LDAP query string into the Enter LDAP query box.
Click OK twice.


Some LDAP query examples:
Users whose accounts are disabled

Users that must change password at next logon

Find Groups that contains the word admin

Find users who have admin in description field

Groups with No Members (finds groups that have no members in them)
Note: The ! symbol means “Not” and * means “Has a value,” so the combination of the two evaluates to “Doesn’t have a value.”

Finds all groups defined as a Global Group, a Domain Local Group, or a Universal Group

Find user accounts with passwords set to never expire

Find all users that never log in to domain

Find user accounts with no log on script

Find user accounts with no profile path

Finds non disabled accounts that must change their password at next logon

Finds all disabled accounts in active directory

Finds all locked out accounts

Finds Domain Local Groups

Finds all Users with Email Address set

Finds all Users with no Email Address

Find all Users, Groups or Contacts where Company or Description is Contractors

Find all Users that are almost Locked-Out
Notice the “>=” that means “Greater than or equal to”.

Find all Computers that do not have a Description

Find all users with Hidden Mailboxes

Find all Windows 2000 SP4 computers
(&(&(&(objectCategory=Computer)(operatingSystem=Windows 2000 Professional)(operatingSystemServicePack=Service Pack 4))))

Find all Windows XP SP2 computers
(&(&(&(&(&(&(&(objectCategory=Computer)(operatingSystem=Windows XP Professional)(operatingSystemServicePack=Service Pack 2))))))))

Find all Windows XP SP3 computers
(&(&(&(&(&(&(&(objectCategory=Computer)(operatingSystem=Windows XP Professional)(operatingSystemServicePack=Service Pack 3))))))))

Find all Vista SP1 computers
(&(&(&(&(sAMAccountType=805306369)(objectCategory=computer)(operatingSystem=Windows Vista*)(operatingSystemServicePack=Service Pack 1)))))

Find All Workstations

Find all 2003 Servers Non-DCs
(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server 2003*)))

Find all 2003 Servers – DCs
(&(&(&(samAccountType=805306369)(primaryGroupID=516)(objectCategory=computer)(operatingSystem=Windows Server 2003*))))

Find all Server 2008
(&(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server 2008*))))


One of the other features I like to enable is the Status option within ADUC.  It will provide a total of all the objects in the ADUC window.



Next time we will look at AD Administrative Center the new ADUC well kinda.

By |2016-04-12T11:06:25+00:00June 4th, 2015|Uncategorized|0 Comments

About the Author:

Chris Meyers
Consultant – Model Technology Solutions Chris has more than 20 years of industry experience. Prior to his work with Model, Chris worked for one of St. Louis’ largest law firms where his responsibilities ranged from implementing Citrix to automating desktop deployments to virtualizing the datacenter. He has also worked with Microsoft’s Rapid Deployment Program to bring new technologies to one of the three largest consumer credit reporting agencies in the US.

Model Technology

Let us help you get your end point and data center strategy on cruise control!  Ask about our Calibration Assessment.


  • 12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141
  • (314) 254-4138