8,330 questions
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