我已将以下两个实体添加到我的域中:
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)'我只希望得到一个回应: CN=Leon\,Jennifer,CN=Users,DC=LH269,DC=com
为什么我会得到两个结果?在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)发布于 2018-05-23 14:50:44
您可以强制ANR要求对任何属性进行精确匹配。
“任何”都是这里的关键词。这两个帐户都有被搜索的属性,这些属性与"leon“完全匹配。
Surname : LeonSamAccountName : leonhttps://stackoverflow.com/questions/50487202
复制相似问题