代码之家  ›  专栏  ›  技术社区  ›  ilansch

两个等号(==)不工作

  •  0
  • ilansch  · 技术社区  · 7 年前

    我已将以下2个实体添加到我的域中:

    PS C:\Users\Administrator.LH269> Get-ADUser -LDAPFilter '(anr==leon)'
    DistinguishedName : CN=Leon1,CN=Users,DC=LH269,DC=com
    Enabled           : True
    GivenName         : Jennifer
    Name              : Leon1
    ObjectClass       : user
    ObjectGUID        : 942dd033-6414-471b-b142-77ac954c3d07
    SamAccountName    : leon-s
    SID               : S-1-5-21-2040647692-1963463148-3417863429-1151
    Surname           : Leon
    UserPrincipalName : Leon1@LH269.com
    
    DistinguishedName : CN=Leon\, Jennifer,CN=Users,DC=LH269,DC=com
    Enabled           : True
    GivenName         : Jennifer
    Name              : Leon, Jennifer
    ObjectClass       : user
    ObjectGUID        : ff0aae88-83ad-4118-a76f-fdd90242ead5
    SamAccountName    : leon
    SID               : S-1-5-21-2040647692-1963463148-3417863429-1145
    Surname           : Leon-Jarama
    UserPrincipalName : Leon@LH269.com
    

    当我执行以下查询时:

    Get-ADUser -LDAPFilter '(anr==leon)'
    

    我只能得到1个回复:cn=leon\,jennifer,cn=users,dc=lh269,dc=com

    为什么我会得到2个结果?在ANR文档中,当使用ANR==XXX时,它清楚地表明:

    You can force ANR to require an exact match on any of the attributes in the table by starting the value with the equal sign, "=" (so the filter has two equal signs)
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Gabriel Luci    7 年前

    你可以强迫ANR在 任何 属性的

    “any”是这里的关键词。这两个帐户都有与“leon”完全匹配的属性,由anr搜索。

    Surname           : Leon
    
    SamAccountName    : leon
    
    推荐文章