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)

11 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 “[email protected]” -W -H ldaps:// -b “DC=example,DC=com” “(&(objectcategory=computer)(”

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

  6. AselaP

    I am trying to filter by the 3rd char of the Server name, so something like

    Get-ADComputer -Filter ‘Name -like “???r*”‘ | select-object name

    I was using “?” for the place holder but that does not work, any ideas?

  7. Adrian Kielbowicz Post author


    I am not quite sure I follow what you are trying to do?

    Are you saying the servers are named in such way that you want to essentially ignore first 3 characters and start your search on the 4th?

    Please clarify and maybe give some server names (as examples) so we can move forward 😉

  8. AselaP

    thanks for the quick response, examples of server names are


    so, the first 3 char signify location, however i need to look for the 4th char / filter by the 4th char. This letter signifies the environment. i need to patch servers in a certain environment.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.