understanding the use of LDAPFilter

Welcome Forums General PowerShell Q&A understanding the use of LDAPFilter

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
2 years, 10 months ago.

  • Author
    Posts
  • #32957

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

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

  • #32971

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    Thank you Richard.

The topic ‘understanding the use of LDAPFilter’ is closed to new replies.