gpt4 book ai didi

powershell - Active Directory "-approx"过滤器运算符如何工作?

转载 作者:行者123 更新时间:2023-12-02 00:50:59 24 4
gpt4 key购买 nike

在今天早些时候查看 AD Cmdlet -Filter 运算符时,我遇到了一个我以前从未见过的运算符:-approx。我可以在几个博客和一些 TechNet 文章中找到这个运算符,但我找不到任何内容来解释这个运算符的用途。我也找不到任何超出其使用定义为“近似等于”或 ~= 的使用示例。我在 Ruby 中编程时唯一一次使用 ~= 运算符,它进行正则表达式匹配,但正则表达式匹配在这种情况下似乎不是这样使用的。我让它返回任何内容的唯一方法是,如果我提供我正在过滤的属性的确切值,就像在这个例子中一样:

 Get-AdUser -Filter "samaccountname -approx 'myexactsamaccountname'"

此运算符的正确用法是什么?作为 Active Directory 管理员使用它的示例有哪些?

最佳答案

这可能不像您希望的那样令人兴奋,但是...

来自Active Directory Technical Specification §3.1.1.3.1.3.1 :

Active Directory supports the approxMatch filter clause of [RFC2251] section 4.5.1. However, it is implemented identically to equalityMatch; for example, the filter is true if the values are equal. No approximation is performed. Filter clauses of the form "(X=Y)" and "(X~=Y)" can be freely substituted for each other.

(强调)

所以,它之所以存在,是因为 RFC2251 定义(和 RFC4511 描述)approxMath 作为 LDAPv3 中支持的运算符集的一部分 - 并且 Microsoft 希望能够声明 LDAP 服务器实现在Active Directory 符合 LDAPv2 和 LDAPv3 - 所以他们在不改变其行为的情况下添加了它(相关 RFC 从未规定过的实现细节)。这符合描述 found in RFC4511 :

An approxMatch filter is TRUE when there is a value of theattribute type or subtype for which some locally-definedapproximate matching algorithm (e.g., spelling variations, phoneticmatch, etc.) returns TRUE. If a value matches for equality, italso satisfies an approximate match. If approximate matching isnot supported for the attribute, this filter item should be treatedas an equalityMatch.

最初的意图可能是允许通用或局部近似,或者可能允许跨多个字母表的等价匹配,即。搜索:

(givenName~=thorbjorn)

将返回具有给定名称 Torbjorn、Þórrbjorn 或 Thorbjørn 的任何人

关于powershell - Active Directory "-approx"过滤器运算符如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57699589/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com