(!(cn=sAMAccountName)) is "RFC-compliant" because the right side of the statement is taken as the value of the cn attribute.
Using this filter will return all entries in the search response where the cn attribute value is present, and the matching rule for cn returns false for the case-insensitive samaccountname (provided that the matching attribute rule cn not been changed from the published standard). Results will be subject to:
- server expiration date
- Server size limit
- server access control
Perhaps you wanted to use
cn=value-of-samaccount-name
source share