List Users Groups And Contact Email Addresses and Alias in Office 365 Using PowerShell
I spend most of my time administering the Exchange side of Office 365 so it pays spend some time experimenting with the commands. The more proficient you are using them the easier your job becomes especially when you need to do something a little more than the web portal is capable of.
List users, groups and contacts E-Mail addresses and Alias
If you don’t know how to get started connecting PowerShell to Office 365 then check out my post here:
If you need to generate a list of all email recipients whether they be users, groups, or contacts you can use the Get-recipient cmdlet. This command by default will only return the name and RecipientType attributes. We can return the list of Email Addresses by piping the objects into the Select statement and choose to return the Displayname, RecipientType and EmailAddresses attributes. Although not shown here the command will also return the types 'MailContact' which are email contacts and 'MailUniversalDistributionGroup' which are email distribution groups.
Get-Recipient | Select DisplayName, RecipientType, EmailAddresses
Sometimes it's easier to export the results to a csv file due to the number of email addresses users and groups can have assigned. Once exported you can manipulate or search the information using Excel.
Get-Recipient | Select DisplayName, RecipientType, EmailAddresses | Export-Csv EmailAddresses.csv
If you are only interested in the primary email address, then use Select to return the DisplayName and PrimarySmtpAddress attributes.
Get-Mailbox |Select-Object DisplayName,PrimarySmtpAddress
If you found this post useful then go buy yourself a copy of my book The Office 365 PowerShell Reference Manual for IT Super Heros!