understanding the use of LDAPFilter

This topic contains 4 replies, has 3 voices, and was last updated by  Graham Beer 2 years, 7 months ago.

  • Author
  • #32957

    Graham Beer

    I have this small line of code to find all Windows 10 machines:

    Get-ADObject -LDAPFilter "(&(operatingSystem=Windows 10 *) (objectClass=computer))" -SearchBase "DC=theaa,DC=local" -SearchScope Subtree |
    select DistinguishedName

    the line i'm interested in is

    "(&(operatingSystem=Windows 10 *) (objectClass=computer))" 

    is the "(&(" and and ? so it allows the two filter requirements ? Not seen it written this way before.

  • #32959

    Matt Bloomfield

    In LDAP syntax the comparison operator goes at the start of the clause so, in your, example. The filter translates to "give me all the objects where the operatingSystem attribute is 'windows 10' AND the object is a computer object".

    Lots of examples and how to use the syntax here: Active Directory LDAP Syntax Filters

  • #32967

    Graham Beer

    Thank you Matt, very helpful. Good link as well.

  • #32971

    Richard Siddaway

    For lots of examples and a explanation of LDAP filters in use see the appendix of Learn Active Directory Management in a Month of Lunches. http://www.manning.com

  • #32996

    Graham Beer

    Thank you Richard.

You must be logged in to reply to this topic.