0

I want to find users having in ProxyAddresses a specyfic mail address. I would like to make this two lines working

$mail = "person@domain.com"
Get-ADUser -Filter {proxyaddresses -like "*$mail*"}  - not working

like this:

Get-ADUser -Filter {proxyaddresses -like "*person@domain.com*"} 

I have tried those but it fails:

Get-ADUser -Filter {proxyaddresses -like "*$($mail)*"}
Get-ADUser -Filter {proxyaddresses -match "$mail"}

I would like to have this command working with a variable ($mail = "person@domain.com")

Adam
  • 5
  • 2
  • 2
    The filter is actually supposed to be a string. Change it to this `Get-AdUser -Filter "proxyaddresses -like '*$mail*'"` – Doug Maurer May 26 '23 at 07:25

0 Answers0