How to get email address of the mailboxes.

Sanjay Bhakuni - admin 155 Reputation points
2024-05-10T03:47:43.0633333+00:00

I have the display name of the users in a csv file. I want to know their email address from PowerShell. I am not able to run the command in AD to get this information. Please provide a PowerShell command which I can run in Exchange online to achieve this.

Exchange Online
Exchange Online
A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
{count} votes

Answer accepted by question author
  1. Anonymous
    2024-05-10T10:02:57.8633333+00:00

    Hi,

    Thanks for posting your question in the Microsoft Q&A forum.

    Based on your description, I would suggest that you use the Import-Csv " location of the CSV file \name.csv" | ForEach-Object {  Get-Mailbox -Identity $_.DisplayName | Select-Object DisplayName,PrimarySmtpAddress} cmdlet to get the user's email address.

    Make sure your CSV file has a column named "DisplayName" and a column named "PrimarySmtpAddress".

    Here are my test over results:

    User's image

    If my reply helps you, please mark him as an answer. Thanks for the support and understanding.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 47,581 Reputation points
    2024-05-10T06:30:19.54+00:00
    0 comments No comments

Your answer

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