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