Active Directory “computer name contains” search string

Windows_7_Logo

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:

(&(objectcategory=computer)(name=*0112*))

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

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

  1. Support Add

    LDAP:
    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:

    (&(objectcategory=computer)(name=*0112*)(!userAccountControl:1.2.840.113556.1.4.803:=2))

  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:
    (&(objectcategory=computer)(Description=*Asus*))
    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:

    (&(objectCategory=computer)(description=*Mini*))

    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.

Leave a Reply