Hi David,
After consulting our related team, we can achieve your goal via the following “piped-command”:
Get-Recipient |ft Displayname, RecipientType, PrimarySmtpAddress, EmailAddresses –Wrap
Thanks,
Gary
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The following Powershell command does not give the results expected:
get-recipient | Select-Object -property DisplayName -ExpandProperty emailaddresses
As per (example 2):
https://msdn.microsoft.com/powershell/reference/5.1/Microsoft.PowerShell.Utility/Select-Object
What am I doing wrong?
Thanks in advance
David (Nobby) Barnes
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Hi David,
After consulting our related team, we can achieve your goal via the following “piped-command”:
Get-Recipient |ft Displayname, RecipientType, PrimarySmtpAddress, EmailAddresses –Wrap
Thanks,
Gary
Hi David,
About the cmdlet in example 2, it gets information about the modules used by the processes on the computer as described in the article. However, we will get all the email addresses in the organization. Here is my example:
Is the result same as yours? What do you want to achieve?
Thanks,
Gary
Hi David,
Can you provide the information I mentioned above when you have time?
Thanks,
Gary
I get the same/very similar to you.
what I was expecting was something like:
DisplayName: Fred Blogs
EmailAddresses: SMTP:******@blogs.com
smtp:******@blogs.onmicrosoft.com
DisplayName: Wilma Fredstone
EmailAddresses: SMTP:******@blogs.com
smtp:******@blogs.onmicrosoft.com
...
The '-property displayname' just seems to be ignored
get-recipient | Select-Object -property DisplayName -ExpandProperty emailaddresses
-and-
get-recipient | Select-Object -ExpandProperty emailaddresses
Gives the same results !!
get-recipient | Select-Object -property DisplayName
Correctly gives a list of recipient display names
This confuses me greatly
Maybe I'm mixing classes or object types or some such..
Thanks
Hi David,
Thanks for your reply. To achieve the goal, please run the cmdlet below to achieve your goal:Get-Recipient -ResultSize Unlimited | select DisplayName,EmailAddresses
Note: you can also export the display name and email addresses to a .csv file by running this cmdlet:
Get-Recipient -ResultSize Unlimited | select DisplayName,RecipientType,EmailAddresses | Export-Csv email-recipients.csv
The .csv file is stored in C:\Windows\System32\WindowsPowerShell\v1.0.
Thanks,
Gary