如何在 proxyAddresses 上使用带有 -LDAPFilter 的 Get-AdObject?

Ran*_*Dom 4 powershell exchange active-directory ldap microsoft-office-365

我正在尝试使用 ADObject 上的 LDAPFilter 搜索 SMTP 地址

Get-AdObject  -properties * -LDAPFilter "(proxyAddresses=alert.haveibeenpwned@test.edu)" 
Run Code Online (Sandbox Code Playgroud)

我知道使用 GetADUser 和 Get-Mailbox 或什至使用带有-anr命令的-Filter 可以实现其中的某些功能。但是,为了保持一致性,我更喜欢将本机 LDAP 与 Get-AdObject 命令一起使用。

如何使用 Get-AdObject 搜索多值属性,例如 proxyAddresses?

Mas*_*imo 5

Get-ADObject -Properties * -Filter {ProxyAddresses -eq "smtp:email@yourdomain.com"}
Get-ADObject -Properties * -LDAPFilter "(proxyAddresses=smtp:email@yourdomain.com)"
Run Code Online (Sandbox Code Playgroud)

过滤多值属性时,如果任何值与搜索字符串匹配,则满足过滤器要求。

但请注意语法smtp:email@yourdomain.com;该ProxyAddresses属性值总是有smtp:前缀(或一个不同的前缀为其他地址类型,例如SIP或X400)。