I need a powershell script, to get login names using the e-mail address. i am having a note with e-mail address of some users. I want to get login IDs and account information of the users in the domain. Can any one help on this.

Regards, Karthick.


You can easily accomplish this using:

Get-ADUser -Filter {Emailaddress -eq 'Test@email.com'}
  • 1
    Get-ADUser -Filter {EmailAddress -eq 'test@email.com'} -Properties name | Select Name – karthick Sep 12 '14 at 13:09

This command will take input from a TXT file containing user email addresses and output the listed user properties to a CSV file...

Get-Content C:\users.txt | ForEach-Object { ^
  Get-ADUser -Filter {EmailAddress -eq $_} -Properties DistinguishedName,Name,SamAccountName,DisplayName,EmailAddress,LastLogonDate,Enabled ^
  | Select-Object DistinguishedName,Name,SamAccountName,DisplayName,EmailAddress,LastLogonDate,Enabled ^
  | Export-CSV C:\users.csv -Append ^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.