Export shared mail aliases in Office 365

Get-Mailbox -RecipientTypeDetails SharedMailbox | Select-Object DisplayName,@{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_ -LIKE “SMTP:*”}}} | Out-GridView

Displaying the complete results is actually a pain in the *** so I would advise to just CTRL+A CTRL C to copy the grid output.

If you only want to export the primary alias (that is SMTP with capital letters) you will have to change -Like to -clike because -Like is not case sensitive. So your command would be:

Get-Mailbox -RecipientTypeDetails SharedMailbox | Select-Object DisplayName,@{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_ -clike "SMTP:*"}}} | Out-GridView