How does Powershell Get multiple specified user properties using the get-aduser filter
I need to get the email addresses of users a, b, c ,It needs to be obtained once in -fiter。
Get-ADUser -Filter 'SamAccountName -like “a” -and Mail -like “ *”'
Or some other method.
Second question
$DN = "ou=chx,DC=hpi,DC=com,DC=cn"
$1 = "aa","bb"
########################################
Get-ADUser -SearchBase $DN -Filter "SamAccountName -like '$1[0]'"
The user cannot be obtained using this method and how to implement it.