Active Directory “computer name contains” search string


You just have to love the simple things in this world that are not so obvious at first thought…

In AD if you try to search for computer name and would like to be slightly more specific you have a problem. Here is the default choice:

The rather obvious choice would include “computer name contains” but sadly the option is not there! Solution? Simple – use LDAP search string instead! In ADUC define new query with custom search for:


where 0112 is what you’re looking for (or computer name contains)

8 thoughts on “Active Directory “computer name contains” search string

  1. Support Add

    Icon: find objects in Active Directory Domain Services

    > Change Find Dropdown-List from “Users, Contacts and Groups” to “Custom Search”
    > Go to Advanced Tab
    > Enter LDAP guery

  2. Adrian Kielbowicz Post author

    Thomas, please add (!userAccountControl:1.2.840.113556.1.4.803:=2) in your string to filter out disabled accounts. This should read as follows:


  3. Joe Jett

    Hello Adrian
    I’m trying to use your formula to search the Computer Description field for the word Asus. Shouldn’t this work:
    I get a blank when I execute it and I know there are Computers with Asus in the Description. Here is one: NERI – Grandview Maint Lunchroom Win7-64 Asus

  4. Adrian Kielbowicz Post author

    Joe, apologies for late reply. I have number of machines with the word ‘Mini’ in the description and the following works as expected:


    PowerShell is probably the way to go here as in:

    Get-ADComputer -filter {Description -like “*Mini*”} | select name

    gets you the same set of results as the LDAP statement above.

  5. Ashutosh Kumar

    ldapsearch -t -x -D “” -W -H ldaps:// -b “DC=example,DC=com” “(&(objectcategory=computer)(”

    can someone tell me what wrong this to get the computer description

Leave a Reply