I need a scipt to get samaccountname from an e-mail address.
I have the script for getting samaccountname from display name
$mbxlist = Get-Content E:\Sid\Users.txtForEach ($mbx in $mbxList ) {
Get-ADUser -Filter "Name -eq '$mbx'" | Select -Property SamAccountName
}
What changes i need to make in this script to use an e-mail address instead of display name
The text file Users.txt contains display names. do i need to replace the Contents of the text files with e-mail addresses?
Please advise