Try using the below command to export your DLs and o365 groups with their displaynames and email addresses to CSV
Get-DistributionGroup | Select DisplayName, PrimarySmtpAddress, EmailAddresses | Export-csv C:\test\DLs.csv -NoTypeInformation
Get-UnifiedGroup | Select DisplayName, PrimarySmtpAddress, EmailAddresses | Export-csv C:\test\Unifiedgroups.csv -NoTypeInformation
And the results show like below:
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.