Use LDAP to find attribute values consisting of a single space character

By | November 5, 2014

A question came up in the forums today about how to use the AD Powershell cmdlets to find objects with attribute values that contain a single space. It’s a good question and relevant because often your results can be skewed by such values when searching for attributes that are not NULL (a space character is not a NULL). Anyway, here’s an example of how to do it using the LDAPFilter.

Get-ADUser -LDAPFilter "(telephonenumber=\20)"

The “\” is the standard escape character for use in LDAP searches and “20” is the HEX representation of the space character.

The filter should also work with other LDAP clients (e.g. LDP.EXE).

2 thoughts on “Use LDAP to find attribute values consisting of a single space character

Leave a Reply

Your email address will not be published. Required fields are marked *