How to fetch email address from AD given users ID

Mina Kamel 46 Reputation points
2021-02-15T14:13:28.707+00:00

Hello,

is there a way that I can obtain the email address from given user in the form of domain\ID from AD using powershell.

thanks for all the help.

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2021-02-15T14:35:34.397+00:00

    Hi @Mina Kamel ,

    I answered your question already here: https://learn.microsoft.com/en-us/answers/questions/269615/howto-obtain-email-addresses-from-ad-given-the-use.html
    Hope this helps (not tested):

     $user = 'domain\peter'  
     $SamAccountName = $user.Split('\')[1]  
     Get-ADUser -Identity $SamAccountName -Properties EmailAddress  
    

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.