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).

Share:
6,594

Related videos on Youtube

Ran Dom
Author by

Ran Dom

Updated on September 18, 2022

Comments

  • Ran Dom
    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
    SamErde almost 6 years
    For @Ran Dom's sake, you can clean up the output by adding " | Select-Object Name,ProxyAddresses" to the end of these commands.
  • SamErde
    SamErde almost 6 years
    Absolutely agree. Just adding that tip in case he had a follow-up question about the output.