How to get email address of the mailboxes.

Sanjay Bhakuni - admin 145 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.

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,636 questions
{count} votes

Accepted answer
  1. Bruce Jing-MSFT 6,940 Reputation points Microsoft Vendor
    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 45,371 Reputation points
    2024-05-10T06:30:19.54+00:00
    0 comments No comments

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.