How do I use Get-AdObject with an -LDAPFilter on proxyAddresses?
6,594
Get-ADObject -Properties * -Filter {ProxyAddresses -eq "smtp:[email protected]"}
Get-ADObject -Properties * -LDAPFilter "(proxyAddresses=smtp:[email protected])"
When filtering on multivalued properties, the filter is satisfied if any of the values matches the search string.
But please note the syntax smtp:[email protected]
; the ProxyAddresses
attribute values always have the smtp:
prefix (or a different prefix for other address types, like SIP or X400).
Related videos on Youtube
Author by
Ran Dom
Updated on September 18, 2022Comments
-
Ran Dom over 1 year
I'm trying to search for SMTP addresses using an LDAPFilter on ADObject
Get-AdObject -properties * -LDAPFilter "([email protected])"
I understand that some of this is possible with GetADUser and Get-Mailbox, or even with the -Filter with the
-anr
command. However for consistency I'd prefer to use native LDAP with the Get-AdObject command.How can I search a multivalued property, like proxyAddresses using Get-AdObject?
-
SamErde almost 6 yearsFor @Ran Dom's sake, you can clean up the output by adding " | Select-Object Name,ProxyAddresses" to the end of these commands.
-
SamErde almost 6 yearsAbsolutely agree. Just adding that tip in case he had a follow-up question about the output.